Hi All,

I'm trying to simply encrypt a simple XML file with the encryption
sample available.
org.apache.xml.security.samples.encryption.Encrypter;

But I get the foollowning exception when I set the key size to 192 or
256 in the GenerateDataEncryptionKey() method.

java.lang.SecurityException: Unsupported keysize or algorithm parameters
        at javax.crypto.Cipher.init(DashoA6275)
        at org.apache.xml.security.encryption.XMLCipher.encryptData(XMLCipher.java:957)
        at 
org.apache.xml.security.encryption.XMLCipher.encryptElementContent(XMLCipher.java:735)
        at org.apache.xml.security.encryption.XMLCipher.doFinal(XMLCipher.java:858)
        at 
org.apache.xml.security.samples.encryption.Encrypter.main(Encrypter.java:195)


Can someone please explain whether I'm doing some thing theoritically
wrong or the correct way to encrypt using AES 192 and AES 256.

Thanks,
Ruchith


   private static SecretKey GenerateDataEncryptionKey() throws Exception {

        String jceAlgorithmName = "AES";
        KeyGenerator keyGenerator =
            KeyGenerator.getInstance(jceAlgorithmName);
        keyGenerator.init(192);  //Setting the key length :-?
        return keyGenerator.generateKey();
    }

Reply via email to