You can't use a Key of type "SHA256withECDSA" for Encryption, only for


On Mon, Jan 7, 2013 at 3:11 PM, Thomas Hofer <>wrote:

>  Hello!
> I'm trying to use WSS4J in combination with elliptic curve cryptography. I
> installed BouncyCastle as provider.
> The PublicKey is of type SHA256withECDSA stored in a JKS, created with the
> Java keytool (Java 7). The whole setup works if I switch to RSA keys, but
> when I'm using an EC key following exception occurs:
> Caused by: unknown key type passed to
>     at
> org.bouncycastle.jcajce.provider.asymmetric.rsa.CipherSpi.engineInit(Unknown
> Source)
>     at javax.crypto.Cipher.implInit(
>     at javax.crypto.Cipher.chooseProvider(
>     at javax.crypto.Cipher.init(
>     at javax.crypto.Cipher.init(
>     at
> So far I found no way to set the algorithm used to create the key. The
> problem occurs when WSSecEncryptedKey.prepareInternal(...) tries to
> initialize the cipher
> cipher.init(Cipher.WRAP_MODE, remoteCert.getPublicKey(),
> oaepParameterSpec);
> Some hints or links to tutorials are really appreciated. So far I found
> nothing helpful.
> Best regards
> Thomas Hofer

Colm O hEigeartaigh

Talend Community Coder

Reply via email to