You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@santuario.apache.org by "Urciolo, Kevin J (IS)" <Ke...@ngc.com> on 2014/04/26 18:53:55 UTC

NSS With XMLEnc

I have the following setup:
JAVA 7
mozilla-nss-3.15.4-0.7.1
Sun PKCS#11 provider
XML Encryption

I am attempting to encrypt a symmetric key to send via XML Encryption.  However, I am having trouble finding an algorithm that works between PKCS11 and XML Encryption.  I am getting the exception below.  Do you have any suggestions?

Exception:
org.apache.xml.security.encryption.XMLEncryptionException: No such algorithm: AES/CBC/ISO10126Padding
Original Exception was java.security.NoSuchAlgorithmException: No such algorithm: AES/CBC/ISO10126Padding
        at org.apache.xml.security.encryption.XMLCipher.constructCipher(XMLCipher.java:1562)
        at org.apache.xml.security.encryption.XMLCipher.<init>(XMLCipher.java:320)
        at org.apache.xml.security.encryption.XMLCipher.getProviderInstance(XMLCipher.java:465)
Caused by: java.security.NoSuchAlgorithmException: No such algorithm: AES/CBC/ISO10126Padding
        at javax.crypto.Cipher.getInstance(Cipher.java:673)
        at javax.crypto.Cipher.getInstance(Cipher.java:580)
        at org.apache.xml.security.encryption.XMLCipher.constructCipher(XMLCipher.java:1544)
        ... 4 more
Caused by: java.security.NoSuchAlgorithmException: Unsupported mode CBC
        at sun.security.pkcs11.P11Cipher.engineSetMode(P11Cipher.java:202)
        at javax.crypto.Cipher$Transform.setModePadding(Cipher.java:357)
        at javax.crypto.Cipher.getInstance(Cipher.java:655)
        ... 6 more

Printed Out Provider Information:
        Signature.MD2withRSA    sun.security.pkcs11.P11Signature
        Cipher.DES/CBC/NoPadding        sun.security.pkcs11.P11Cipher
        Cipher.AES/CBC/PKCS5Padding     sun.security.pkcs11.P11Cipher
        Cipher.RSA/ECB/NoPadding        sun.security.pkcs11.P11RSACipher
        Cipher.DES/CBC/PKCS5Padding     sun.security.pkcs11.P11Cipher
        KeyFactory.DH   sun.security.pkcs11.P11DHKeyFactory
        AlgorithmParameters.EC  sun.security.ec.ECParameters
        Signature.RawDSA        sun.security.pkcs11.P11Signature
        KeyGenerator.SunTlsMasterSecret sun.security.pkcs11.P11TlsMasterSecretGenerator
        Cipher.RSA/ECB/PKCS1Padding     sun.security.pkcs11.P11RSACipher
        Alg.Alias.Cipher.RSA    RSA/ECB/PKCS1Padding
        Alg.Alias.MessageDigest.SHA-1   SHA1
        Signature.SHA256withECDSA       sun.security.pkcs11.P11Signature
        Alg.Alias.KeyAgreement.DiffieHellman    DH
        Signature.SHA512withECDSA       sun.security.pkcs11.P11Signature
        Alg.Alias.KeyPairGenerator.DiffieHellman        DH
        KeyAgreement.DH sun.security.pkcs11.P11KeyAgreement
        Alg.Alias.Signature.ECDSA       SHA1withECDSA
        Cipher.DESede/ECB/NoPadding     sun.security.pkcs11.P11Cipher
        KeyAgreement.ECDH       sun.security.pkcs11.P11ECDHKeyAgreement
        Provider.id className   sun.security.pkcs11.SunPKCS11
        Alg.Alias.MessageDigest.SHA     SHA1
        Mac.HmacSHA384  sun.security.pkcs11.P11MAC
        Cipher.AES/ECB/NoPadding        sun.security.pkcs11.P11Cipher
        Mac.HmacSHA512  sun.security.pkcs11.P11MAC
        KeyFactory.DSA  sun.security.pkcs11.P11DSAKeyFactory
        Mac.HmacMD5     sun.security.pkcs11.P11MAC
        Mac.SslMacMD5   sun.security.pkcs11.P11MAC
        SecretKeyFactory.ARCFOUR        sun.security.pkcs11.P11SecretKeyFactory
        Mac.HmacSHA1    sun.security.pkcs11.P11MAC
        KeyGenerator.DES        sun.security.pkcs11.P11KeyGenerator
        Mac.SslMacSHA1  sun.security.pkcs11.P11MAC
        Alg.Alias.Cipher.DESede DESede/ECB/PKCS5Padding
        KeyPairGenerator.EC     sun.security.pkcs11.P11KeyPairGenerator
        Cipher.DESede/CBC/PKCS5Padding  sun.security.pkcs11.P11Cipher
        SecretKeyFactory.DES    sun.security.pkcs11.P11SecretKeyFactory
        Provider.id name        SunPKCS11-NSSfips
        Cipher.DESede/CBC/NoPadding     sun.security.pkcs11.P11Cipher
        Signature.SHA384withECDSA       sun.security.pkcs11.P11Signature
        Cipher.AES/ECB/PKCS5Padding     sun.security.pkcs11.P11Cipher
        Signature.SHA1withRSA   sun.security.pkcs11.P11Signature
        KeyStore.PKCS11 sun.security.pkcs11.P11KeyStore
        KeyGenerator.AES        sun.security.pkcs11.P11KeyGenerator
        Cipher.DES/ECB/PKCS5Padding     sun.security.pkcs11.P11Cipher
        Cipher.ARCFOUR  sun.security.pkcs11.P11Cipher
        SecretKeyFactory.DESede sun.security.pkcs11.P11SecretKeyFactory
        Alg.Alias.Signature.SHA1withDSA DSA
        Signature.MD5withRSA    sun.security.pkcs11.P11Signature
        MessageDigest.SHA-384   sun.security.pkcs11.P11Digest
        SecretKeyFactory.AES    sun.security.pkcs11.P11SecretKeyFactory
        Signature.SHA512withRSA sun.security.pkcs11.P11Signature
        KeyPairGenerator.RSA    sun.security.pkcs11.P11KeyPairGenerator
        Cipher.AES/CBC/NoPadding        sun.security.pkcs11.P11Cipher
        KeyPairGenerator.DH     sun.security.pkcs11.P11KeyPairGenerator
        Alg.Alias.AlgorithmParameters.1.2.840.10045.2.1 EC
        KeyGenerator.ARCFOUR    sun.security.pkcs11.P11KeyGenerator
        MessageDigest.SHA-512   sun.security.pkcs11.P11Digest
        KeyGenerator.SunTlsPrf  sun.security.pkcs11.P11TlsPrfGenerator
        Provider.id version     1.7
        Alg.Alias.KeyFactory.DiffieHellman      DH
        Signature.SHA1withECDSA sun.security.pkcs11.P11Signature
        Signature.SHA256withRSA sun.security.pkcs11.P11Signature
        KeyGenerator.SunTlsKeyMaterial  sun.security.pkcs11.P11TlsKeyMaterialGenerator
        Alg.Alias.Cipher.DES    DES/ECB/PKCS5Padding
        Alg.Alias.Signature.NONEwithDSA RawDSA
        Mac.HmacSHA256  sun.security.pkcs11.P11MAC
        Alg.Alias.KeyStore.PKCS11-NSSfips       PKCS11
        Alg.Alias.Cipher.RC4    ARCFOUR
        Signature.SHA384withRSA sun.security.pkcs11.P11Signature
        Alg.Alias.KeyGenerator.RC4      ARCFOUR
        Cipher.DES/ECB/NoPadding        sun.security.pkcs11.P11Cipher
        Cipher.DESede/ECB/PKCS5Padding  sun.security.pkcs11.P11Cipher
        Cipher.AES/CTR/NoPadding        sun.security.pkcs11.P11Cipher
        Alg.Alias.Cipher.AES    AES/ECB/PKCS5Padding
        KeyGenerator.SunTlsRsaPremasterSecret   sun.security.pkcs11.P11TlsRsaPremasterSecretGenerator
        SecureRandom.PKCS11     sun.security.pkcs11.P11SecureRandom
        Alg.Alias.SecretKeyFactory.RC4  ARCFOUR
        Signature.NONEwithECDSA sun.security.pkcs11.P11Signature
        KeyFactory.RSA  sun.security.pkcs11.P11RSAKeyFactory
        KeyFactory.EC   sun.security.pkcs11.P11DHKeyFactory
        KeyPairGenerator.DSA    sun.security.pkcs11.P11KeyPairGenerator
        Provider.id info        SunPKCS11-NSSfips using library null
        MessageDigest.SHA1      sun.security.pkcs11.P11Digest
        Signature.DSA   sun.security.pkcs11.P11Signature
        MessageDigest.SHA-256   sun.security.pkcs11.P11Digest
        MessageDigest.MD5       sun.security.pkcs11.P11Digest
        MessageDigest.MD2       sun.security.pkcs11.P11Digest
        KeyGenerator.DESede     sun.security.pkcs11.P11KeyGenerator