Since you are using the CBC mode of the algorithm, you must provide an initialization vector (IV). Pass in an org.mozilla.jss.crypto.IVParameterSpec.
Java's Cipher class works the same way. Their IV class is called javax.crypto.spec.IvParameterSpec. In the next version of JSS this will be the way to go. Patrick wrote: > I haver a Cipher object returned by CryptoToken's > getCipherContext(EncryptionAlgorithm.DES3_CBC) > But when I go to encrypt with initEncrypt(symKey) I get the following error: > > "java.security.InvalidAlgorithmParameterException: DES3/CBC requires an > algorithm parameter > at > org.mozilla.jss.pkcs11.PK11Cipher.checkParams(PK11Cipher.java:223) > at > org.mozilla.jss.pkcs11.PK11Cipher.initEncrypt(PK11Cipher.java:100) > at > org.mozilla.jss.pkcs11.PK11Cipher.initEncrypt(PK11Cipher.java:83)" > > What AlgorithmParameterSpec am I suppposed to pass in? I would have thought > that getCipherContext(EncryptionAlgorithm.DES3_CBC) would be enough for > specifying the encryption algorithm... > > -- P > > >
