From: Ian G <ia...@sy...> - 2008-11-24 14:39:52
|
noreen wrote: > > Do RSA legacy keys always use key type RSA and the IDEA cipher? How do > you create an RSA key with cipher=IDEA? PGP 2.6 and before were RSA+IDEA only. in PGP5.0, variations were added to both axes, and IDEA was deprecated because it was a patented algorithm or somesuch, so most switched over to DSS+3DES or RSA+3DES. However, this is only PGP 2.6, whereas below you have a format=x.509 key which is not PGP. > I have included the code so far with the error that was generated: > > //create an RSA key > KeyPairGenerator keyPairGen = KeyPairGenerator.getInstance( "RSA" ); > this.cipher = Cipher.getInstance("RSA"); > keyPairGen.initialize( 1024 ); > > // use the key to initialize the idea cipher > this.cipher = Cipher.getInstance("IDEA", "CryptixCrypto"); > cipher.init( Cipher.ENCRYPT_MODE, keyParirGen.getKeyPair.getPublic() ); Is that the right arguments? I cannot recall what init does, but I imagine you have to provide it with a secret keyphrase of the right length, not the public key. iang > CODE OUTPUT > cipher algorithm IDEA BlockSize=8 > KeyPair Algorithm RSA > Key AlgorithmRSA format= X.509 serialVersionID=-8727434096241101194 > Invalid user key length > java.security.InvalidKeyException: Invalid user key length > at cryptix.jce.provider.cipher.IDEA.makeKey(IDEA.java:156) |