Back from holidays...
Well this works fine now : I can retrieve the key and convert it to pkcs11.
But when I verify the signerinfo, I get that exception:
java.security.InvalidKeyException : Key type is inconsistent with algorithm
at org.mozilla.jss.pkcs11.PK11Signature.engineInitVerify(PK11Signature.java:187)
...
The key is RSA and the algorithm of the signer info is SHA-1.
(the signer info is obtained with window.Crypto.SignText() from Netscape)
I don't understand why it doesn't work... RSA & SHA-1 not compatible ??
Stuck:(
Any idea ?
>
> > ...
> > byte[] spkiEncoded = pkey.getEncoded();
> > SubjectPublicKeyInfo spki = (SubjectPublicKeyInfo)
> > SubjectPublicKeyInfo.getTemplate().decode(spkiEncoded);
>
> > ...
>
> Oops, decode takes an InputStream, so instead you'll have to do
>
>
> SubjectPublicKeyInfo.getTemplate().decode(
>
> new java.io.ByteArrayInputStream(spkiEncoded) );