On Thu, Dec 27, 2012 at 9:47 PM, mbarbiero <[email protected]> wrote:

>
> My problem is in the pass 2... I extract public key from certificate, but It
> is not equal to the PublicKey XML DSIG generated by other aplications.

If you don't get exceptions while creating the keys, you are probably OK.
The encoding method might be different, but you probably got the right key.

> Is it a Android problem?

Android's RSAPublicKey.getEncoded() returns the SubjectPublicKeyInfo
structure, which other providers probably don't. This is most probably the
cause of you getting different output. Cf. this:

    public byte[] getEncoded()
    {
        // BEGIN android-changed
        return KeyUtil.getEncodedSubjectPublicKeyInfo(new
AlgorithmIdentifier(PKCSObjectIdentifiers.rsaEncryption,
DERNull.INSTANCE), new
org.bouncycastle.asn1.pkcs.RSAPublicKey(getModulus(),
getPublicExponent()));
        // END android-changed
    }


> Or my code is incorrect?

Seems OK to me.

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

Reply via email to