You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@santuario.apache.org by Zulfi Umrani <zu...@novell.com> on 2003/07/08 01:13:54 UTC

Hi There,

Hi There,
Does anyone know, how to create Public/PrivateKey from a byte[] without
knowing its encoding/algorithm?
This is to set KeyInfo and or signingKey in XMLSignature.

Thanks.

Re: Hi There,

Posted by Marco Brambilla <ma...@cefriel.it>.
Hi,

If I correctly understand your question, you have a byte array and need 
a Key object, don't you ?
In this case you can use the java cryptography extensions, like this:

KeyFactory kf = KeyFactory.getInstance(algrithm);
PublicKey pk = kf.generatePublic(new X509EncodedKeySpec(byte[] encodedKey));

If you are not using an X509 certificate, refer to Sun jdk api 
documentation for the names of other algorithms.

Bye

	Maco

Zulfi Umrani wrote:
> Hi There,
> Does anyone know, how to create Public/PrivateKey from a byte[] without
> knowing its encoding/algorithm?
> This is to set KeyInfo and or signingKey in XMLSignature.
> 
> Thanks.
>