Dear...
I need to create a app to generate XML DSIG compliance signature .
My first options, obviously, is use a magic Java class that sign XML in one
pass, but not exist in Android.
Then, I need create a code to:
1 - read a certificate into keystore;
2 - extract private key and public key;
3 - generate a canonicalized (c14N) data from XML;
4 - generate the digest value (SHA1);
5 - sign the digest;
6 - insert tags in the original XML.
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.
Is it a Android problem?
Or my code is incorrect?
My code:
key = ks.getKey(alias, "password".toCharArray());
if (key instanceof PrivateKey) {
cert = ks.getCertificate(alias);
publicKey = cert.getPublicKey();
privateKey = (PrivateKey) key;
KeyPair kp = new KeyPair(publicKey, privateKey);
mLog.setText("PRIVATEKEY -->"
+ Base64.encodeToString(kp.getPrivate()
.getEncoded(), Base64.NO_WRAP));
mLog.setText(mLog.getText() + "\n\nPUBLICKEY -->"
+ Base64.encode(kp.getPublic().getEncoded(),Base64.NO_WRAP));
}
}
Thanks in advance!
--
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