On Mon, Jan 14, 2013 at 10:39 PM, mbarbiero <marco.barbi...@gmail.com> wrote:
>
>  * does the raw (byte array) signature match?
> - I'm not sure about this, but the digestvalues in dotNet and BoucyCastle
> are identical.

For Java you would get the return value of signer.sign() and convert to
hex to compare. Don't remember the details about .NET.

> - A question: How to cipher digestvalue directly with the privatekey?

You'll have to pad it first as per the PKCS#1.5 spec and then encrypt with the
private key using Cipher.getInstance("RSA/ECP/NoPadding").
Cipher.getInstance("RSA/ECB/PKCS1Padding") should pad it for you.
Those might not be available on all Android versions though. However,
you are probably having a different problem...

>
>  * are you using the same options for Base64? There are subtle variations
> here (padding character, line breaks, etc.).
> - The signatures values are very different. I replace the tag in BC file by
> dotNet signature value and the webservice returns OK. It's a mystery!!!
> Below, the two exemples of the signature.

The XML suggests you are using the same key and signing the same
hash (digest value). However, the most plausible explanation for getting
a different signature value is using different keys. Or maybe you keys
are interpreted differently on both platforms? How do you read/pass the
key on .NET and Java? Are you absolutely sure that it is indeed the same
private key?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to