You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fx-dev@ws.apache.org by Rami Jaamour <rj...@parasoft.com> on 2004/04/01 01:45:29 UTC

attempting to use AES encryption

Hello,

I'm running into this problem when I use an encryption algorithm other 
than 3DES, in this case I was trying AES_128:

org.apache.ws.security.WSSecurityException: An unsupported signature or 
encryption algorithm was used; nested exception is:
    java.security.NoSuchAlgorithmException: Algorithm 
2.16.840.1.101.3.4.1.2 not available
    at 
org.apache.ws.security.message.WSEncryptBody.getKeyGenerator(WSEncryptBody.java:664)
    at 
org.apache.ws.security.message.WSEncryptBody.build(WSEncryptBody.java:273)
...
Caused by: java.security.NoSuchAlgorithmException: Algorithm 
2.16.840.1.101.3.4.1.2 not available
    at javax.crypto.SunJCE_b.a(DashoA6275)
    at javax.crypto.KeyGenerator.getInstance(DashoA6275)
    at 
org.apache.ws.security.message.WSEncryptBody.getKeyGenerator(WSEncryptBody.java:653)
    ... 11 more
[Nested Exception] java.security.NoSuchAlgorithmException: Algorithm 
2.16.840.1.101.3.4.1.2 not available
    at javax.crypto.SunJCE_b.a(DashoA6275)
    at javax.crypto.KeyGenerator.getInstance(DashoA6275)
    at 
org.apache.ws.security.message.WSEncryptBody.getKeyGenerator(WSEncryptBody.java:653)
    at 
org.apache.ws.security.message.WSEncryptBody.build(WSEncryptBody.java:273)
...


WSEncryptBody has the following around line 664:

    private KeyGenerator getKeyGenerator() throws WSSecurityException {
        KeyGenerator keyGen = null;
        try {
            if (symEncAlgo.equalsIgnoreCase(WSConstants.TRIPLE_DES)) {
                keyGen = KeyGenerator.getInstance("DESede");
            } else if (symEncAlgo.equalsIgnoreCase(WSConstants.AES_128)) {
                keyGen = KeyGenerator.getInstance("2.16.840.1.101.3.4.1.2");
            } else if (symEncAlgo.equalsIgnoreCase(WSConstants.AES_192)) {
                keyGen = 
KeyGenerator.getInstance("2.16.840.1.101.3.4.1.22");
            } else if (symEncAlgo.equalsIgnoreCase(WSConstants.AES_256)) {
                keyGen = 
KeyGenerator.getInstance("2.16.840.1.101.3.4.1.42");
            } else {
                return null;
            }
        } catch (NoSuchAlgorithmException e) {
            throw new WSSecurityException(
                WSSecurityException.UNSUPPORTED_ALGORITHM, null, null, e);
        }
        return keyGen;
    }


The java docs of KeyGenerator.getInstance() say that
<<

    The following algorithm names can be specified when requesting an
    instance of |*KeyGenerator*|:

        * *AES*

        * *Blowfish*

        * *DES*

        * *DESede*

        * *HmacMD5*

        * *HmacSHA1*

 >>

So I'm confused what these numbers are or what I could be doing wrong 
since I'm getting the exception above. BTW, I'm using the Unlimited JCE 
from Sun 1.4.2_03.

Thank you,

-- 
Rami Jaamour
Software Engineer
SOAPtest <http://www.parasoft.com/jsp/products/home.jsp?product=SOAP> 
Development
Parasoft Corporation <http://www.parasoft.com>