You can subscribe to this list here.
2003 |
Jan
|
Feb
(45) |
Mar
(7) |
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
(21) |
Sep
|
Oct
|
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
|
Feb
|
Mar
(3) |
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <ed...@bo...> - 2003-07-21 21:39:35
|
edwin 03/07/21 17:39:31 Modified: openpgp/src/cryptix/openpgp/algorithm PGPDSA.java Log: Typo. Revision Changes Path 1.21 +3 -3 projects/openpgp/src/cryptix/openpgp/algorithm/PGPDSA.java Index: PGPDSA.java =================================================================== RCS file: /home/cryptix-cvs/cvsroot/projects/openpgp/src/cryptix/openpgp/algorithm/PGPDSA.java,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- PGPDSA.java 30 Jan 2003 13:30:09 -0000 1.20 +++ PGPDSA.java 21 Jul 2003 21:39:31 -0000 1.21 @@ -1,4 +1,4 @@ -/* $Id: PGPDSA.java,v 1.20 2003/01/30 13:30:09 edwin Exp $ +/* $Id: PGPDSA.java,v 1.21 2003/07/21 21:39:31 edwin Exp $ * * Copyright (C) 1999-2001 The Cryptix Foundation Limited. * All rights reserved. @@ -49,7 +49,7 @@ * * @author Edwin Woudt (ed...@cr...) * @author Jeroen C. van Gelderen (gel...@cr...) - * @version $Revision: 1.20 $ + * @version $Revision: 1.21 $ */ public class PGPDSA implements PGPSigner { @@ -116,7 +116,7 @@ private void initSigObject() { // ### FIXME: This code has been disabled, because the RawDSA algorithm - // ### seems to provider invalid results. + // ### seems to provide invalid results. /* try { sig = Signature.getInstance("RawDSA"); raw = true; |
From: <ed...@bo...> - 2003-07-17 23:08:25
|
edwin 03/07/17 19:08:22 Modified: jce/src/cryptix.jce.provider.key TripleDESKeyGenerator.java Log: Change algorithm name to the Sun default one, as this allows one to use TripleDES without the unlimited strength jurisdiction policy files. Revision Changes Path 1.2 +3 -3 projects/jce/src/cryptix.jce.provider.key/TripleDESKeyGenerator.java Index: TripleDESKeyGenerator.java =================================================================== RCS file: /home/cryptix-cvs/cvsroot/projects/jce/src/cryptix.jce.provider.key/TripleDESKeyGenerator.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- TripleDESKeyGenerator.java 31 Jul 2000 00:55:45 -0000 1.1 +++ TripleDESKeyGenerator.java 17 Jul 2003 23:08:22 -0000 1.2 @@ -1,4 +1,4 @@ -/* $Id: TripleDESKeyGenerator.java,v 1.1 2000/07/31 00:55:45 gelderen Exp $ +/* $Id: TripleDESKeyGenerator.java,v 1.2 2003/07/17 23:08:22 edwin Exp $ * * Copyright (C) 1995-1999 The Cryptix Foundation Limited. * All rights reserved. @@ -14,7 +14,7 @@ /** * A key generator for TripleDES. * - * @version $Revision: 1.1 $ + * @version $Revision: 1.2 $ * @author Jeroen C. van Gelderen (gel...@cr...) */ public class TripleDESKeyGenerator extends RawKeyGenerator { @@ -25,7 +25,7 @@ public TripleDESKeyGenerator() { - super("TripleDES", STRENGTH); + super("DESede", STRENGTH); } |
From: <gel...@mx...> - 2003-03-24 01:56:25
|
gelderen 03/03/23 21:05:27 Modified: jce/src/cryptix.jce.provider.cipher TripleDESInnerCBC.java Log: - Remove broken implementation of engineGetParameters(). Revision Changes Path 1.2 +3 -3 projects/jce/src/cryptix.jce.provider.cipher/TripleDESInnerCBC.java Index: TripleDESInnerCBC.java =================================================================== RCS file: /home/cryptix-cvs/cvsroot/projects/jce/src/cryptix.jce.provider.cipher/TripleDESInnerCBC.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- TripleDESInnerCBC.java 24 Mar 2003 01:54:31 -0000 1.1 +++ TripleDESInnerCBC.java 24 Mar 2003 02:05:27 -0000 1.2 @@ -1,4 +1,4 @@ -/* $Id: TripleDESInnerCBC.java,v 1.1 2003/03/24 01:54:31 gelderen Exp $ +/* $Id: TripleDESInnerCBC.java,v 1.2 2003/03/24 02:05:27 gelderen Exp $ * * Copyright (C) 1995-2000 The Cryptix Foundation Limited. * All rights reserved. @@ -33,7 +33,7 @@ /** * @author Jeroen C. van Gelderen (gel...@cr...) - * @version $Revision: 1.1 $ + * @version $Revision: 1.2 $ */ public final class TripleDESInnerCBC extends CipherSpi { @@ -166,7 +166,7 @@ protected final AlgorithmParameters engineGetParameters() { - return new IvParameterSpec(engineGetIV()); + return null; } |
From: <gel...@mx...> - 2003-03-24 01:51:12
|
gelderen 03/03/23 21:00:13 Modified: jce/doc ChangeLog.txt Log: . Revision Changes Path 1.4 +13 -0 projects/jce/doc/ChangeLog.txt Index: ChangeLog.txt =================================================================== RCS file: /home/cryptix-cvs/cvsroot/projects/jce/doc/ChangeLog.txt,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- ChangeLog.txt 17 Feb 2003 18:35:09 -0000 1.3 +++ ChangeLog.txt 24 Mar 2003 02:00:13 -0000 1.4 @@ -1,6 +1,19 @@ Change Log +2003 03 23 + +- Add TripleDES in 'Inner CBC' mode. JCE architectural braindeadness requires + us to use an ugly transformation name: 'TripleDESInnerCBC/InnerCBC/None'. + Use of padding is NOT supported. + +2003 02 20 + +- Catch problems caused by invalid keys. + (ArithmeticException and invalid block lengths.) + +- Expand a little on the RSA-OAEP test. + 2003 02 17 - Slightly improve RSA_OAEP test: verify output and remove printlns. |
From: <gel...@mx...> - 2003-03-24 01:49:28
|
gelderen 03/03/23 20:58:28 Modified: jce/src/cryptix.jce.test Test.java Log: - Enable TripleDESInnerCBC test. Revision Changes Path 1.24 +3 -3 projects/jce/src/cryptix.jce.test/Test.java Index: Test.java =================================================================== RCS file: /home/cryptix-cvs/cvsroot/projects/jce/src/cryptix.jce.test/Test.java,v retrieving revision 1.23 retrieving revision 1.24 diff -u -r1.23 -r1.24 --- Test.java 15 Feb 2003 13:48:43 -0000 1.23 +++ Test.java 24 Mar 2003 01:58:28 -0000 1.24 @@ -1,4 +1,4 @@ -/* $Id: Test.java,v 1.23 2003/02/15 13:48:43 gelderen Exp $ +/* $Id: Test.java,v 1.24 2003/03/24 01:58:28 gelderen Exp $ * * Copyright (C) 1995-2000 The Cryptix Foundation Limited. * All rights reserved. @@ -15,7 +15,7 @@ { private static final String CLASS_PREFIX = "cryptix.jce.test.Test", - VERSION = "$Revision: 1.23 $"; + VERSION = "$Revision: 1.24 $"; private static boolean verbose=true; @@ -28,7 +28,7 @@ "Blowfish", "CAST5", "DES","IDEA", "MARS", "Null", "RC2", "RC4", "RC6", "Rijndael", "Serpent", "SKIPJACK", "Square", "TripleDES", - "Twofish", + "TripleDESInnerCBC", "Twofish", "RSA_ECB_PKCS1", "RSA_OAEP", "ElGamal", |
From: <gel...@mx...> - 2003-03-24 01:48:40
|
gelderen 03/03/23 20:57:42 Modified: jce/src/cryptix.jce.provider.key RawSecretKey.java Log: - Add ctor with sig (String, byte[], int off, int len). Useful for constructing individual DES keys from a single 3DES key. Revision Changes Path 1.8 +10 -2 projects/jce/src/cryptix.jce.provider.key/RawSecretKey.java Index: RawSecretKey.java =================================================================== RCS file: /home/cryptix-cvs/cvsroot/projects/jce/src/cryptix.jce.provider.key/RawSecretKey.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- RawSecretKey.java 14 May 2000 21:05:58 -0000 1.7 +++ RawSecretKey.java 24 Mar 2003 01:57:42 -0000 1.8 @@ -1,4 +1,4 @@ -/* $Id: RawSecretKey.java,v 1.7 2000/05/14 21:05:58 pw Exp $ +/* $Id: RawSecretKey.java,v 1.8 2003/03/24 01:57:42 gelderen Exp $ * * Copyright (C) 1995-1999 The Cryptix Foundation Limited. * All rights reserved. @@ -17,7 +17,7 @@ /** * FIXME: make package protected. fix tests first. * - * @version $Revision: 1.7 $ + * @version $Revision: 1.8 $ * @author Jeroen C. van Gelderen <gel...@cr...> */ public class RawSecretKey implements SecretKey @@ -31,6 +31,14 @@ { this.algorithm = algorithm; this.keyBytes = (byte[])keyBytes.clone(); + } + + + public RawSecretKey(String algorithm, byte[] keyBytes, int off, int len) + { + this.algorithm = algorithm; + this.keyBytes = new byte[len]; + System.arraycopy(keyBytes, off, this.keyBytes, 0, len); } |
From: <gel...@mx...> - 2003-03-24 01:47:13
|
gelderen 03/03/23 20:56:14 Modified: jce/src/cryptix.jce.provider CryptixCrypto.java Log: - Add TripleDESInnerCBC/InnerCBC/None. Revision Changes Path 1.9 +6 -2 projects/jce/src/cryptix.jce.provider/CryptixCrypto.java Index: CryptixCrypto.java =================================================================== RCS file: /home/cryptix-cvs/cvsroot/projects/jce/src/cryptix.jce.provider/CryptixCrypto.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- CryptixCrypto.java 7 Feb 2003 15:16:01 -0000 1.8 +++ CryptixCrypto.java 24 Mar 2003 01:56:14 -0000 1.9 @@ -1,4 +1,4 @@ -/* $Id: CryptixCrypto.java,v 1.8 2003/02/07 15:16:01 gelderen Exp $ +/* $Id: CryptixCrypto.java,v 1.9 2003/03/24 01:56:14 gelderen Exp $ * * Copyright (C) 1995-2000 The Cryptix Foundation Limited. * All rights reserved. @@ -23,7 +23,7 @@ /** * The Cryptix JCE Strong Crypto Provider. * - * @version $Revision: 1.8 $ + * @version $Revision: 1.9 $ * @author Jeroen C. van Gelderen (gel...@cr...) */ public final class CryptixCrypto extends Provider @@ -116,6 +116,10 @@ "cryptix.jce.provider.key.TripleDESKeyGenerator"); put("Alg.Alias.KeyGenerator.DESede", "TripleDES"); + // TripleDES in Inner CBC mode + put("Cipher.TripleDESInnerCBC", + "cryptix.jce.provider.cipher.TripleDESInnerCBC"); + // Twofish put("Cipher.Twofish", "cryptix.jce.provider.cipher.Twofish"); put("KeyGenerator.Twofish", |
From: <gel...@mx...> - 2003-03-24 01:45:56
|
gelderen 03/03/23 20:54:58 Added: jce/src/cryptix.jce.test TestTripleDESInnerCBC.java Log: - Test for TripleDES 'Inner CBC' mode. Revision Changes Path 1.1 projects/jce/src/cryptix.jce.test/TestTripleDESInnerCBC.java Index: TestTripleDESInnerCBC.java =================================================================== /* $Id: TestTripleDESInnerCBC.java,v 1.1 2003/03/24 01:54:58 gelderen Exp $ * * Copyright (C) 1995-1999 The Cryptix Foundation Limited. * All rights reserved. * * Use, modification, copying and distribution of this software is subject * the terms and conditions of the Cryptix General Licence. You should have * received a copy of the Cryptix General Licence along with this library; * if not, you can download a copy from http://www.cryptix.org/ . */ package cryptix.jce.test; import java.security.Key; import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; import javax.crypto.Cipher; import javax.crypto.KeyGenerator; import javax.crypto.SecretKey; import javax.crypto.spec.IvParameterSpec; final class TestTripleDESInnerCBC extends CipherTest { private static final String NAME="TripleDESInnerCBC/InnerCBC/None"; protected TestTripleDESInnerCBC() { super(NAME); } protected void doIt() throws Exception { testExistence(NAME); testValuesCFB(NAME, VECS); } private String[][] VECS = { { "000000000000000000000000000000000000000000000000", "000000000000000000000000000000000000000000000000", "31366279746573617265656E6F756768", "844758AE22ADF08AC357F0587188242D" } }; protected void testValuesCFB(String alg, String[][] testValues) throws Exception { beginTest("XXX..."); boolean res = true; try { for( int i=0; i<testValues.length; i++) { byte[] key = Util.hexFromString(testValues[i][0]); byte[] iv = Util.hexFromString(testValues[i][1]); byte[] pt = Util.hexFromString(testValues[i][2]); byte[] ct = Util.hexFromString(testValues[i][3]); IvParameterSpec ivs = new IvParameterSpec(iv); Cipher c = Cipher.getInstance(NAME, "CryptixCrypto"); c.init( Cipher.ENCRYPT_MODE, new K(NAME, key), ivs ); byte[] trial_ct = c.doFinal(pt); c.init( Cipher.DECRYPT_MODE, new K(NAME, key), ivs ); byte[] trial_pt = c.doFinal(ct); if( !Util.areEqual(ct, trial_ct) || !Util.areEqual(pt, trial_pt) ) { res = false; } } } catch(Throwable e) { e.printStackTrace(); res = false; } passIf(res); } private class K implements Key { private final byte[] keyBytes; private final String alg; K(String alg, byte[] keyBytes) { this.alg = alg; this.keyBytes = keyBytes; } public String getAlgorithm() { return alg; } public String getFormat() { return "RAW"; } public byte[] getEncoded() { return (byte[])keyBytes.clone(); } } } |
From: <gel...@mx...> - 2003-03-24 01:45:40
|
gelderen 03/03/23 20:54:31 Added: jce/src/cryptix.jce.provider.cipher TripleDESInnerCBC.java Log: - Implementation of TripleDES in 'Inner CBC' mode. This is used in SSH1. Revision Changes Path 1.1 projects/jce/src/cryptix.jce.provider.cipher/TripleDESInnerCBC.java Index: TripleDESInnerCBC.java =================================================================== /* $Id: TripleDESInnerCBC.java,v 1.1 2003/03/24 01:54:31 gelderen Exp $ * * Copyright (C) 1995-2000 The Cryptix Foundation Limited. * All rights reserved. * * Use, modification, copying and distribution of this software is subject * the terms and conditions of the Cryptix General Licence. You should have * received a copy of the Cryptix General Licence along with this library; * if not, you can download a copy from http://www.cryptix.org/ . */ package cryptix.jce.provider.cipher; import java.security.AlgorithmParameters; import java.security.InvalidAlgorithmParameterException; import java.security.InvalidKeyException; import java.security.Key; import java.security.NoSuchAlgorithmException; import java.security.NoSuchProviderException; import java.security.SecureRandom; import java.security.spec.AlgorithmParameterSpec; import java.security.spec.InvalidParameterSpecException; import javax.crypto.BadPaddingException; import javax.crypto.Cipher; import javax.crypto.CipherSpi; import javax.crypto.IllegalBlockSizeException; import javax.crypto.NoSuchPaddingException; import javax.crypto.ShortBufferException; import javax.crypto.spec.IvParameterSpec; import cryptix.jce.provider.key.RawSecretKey; /** * @author Jeroen C. van Gelderen (gel...@cr...) * @version $Revision: 1.1 $ */ public final class TripleDESInnerCBC extends CipherSpi { private static final String PROVIDER = "CryptixCrypto"; private static final int BLOCK_SIZE = 64; // if you change this, fix the getOutputSize function implementation! private static final String ALG_NAME = "DES/CBC/None"; private static final int KEY_SIZE = 24; private final Cipher _c1, _c2, _c3; private static final int IV_SIZE = 24; private byte[] _ivBuf; public TripleDESInnerCBC() { try { _c1 = Cipher.getInstance(ALG_NAME, PROVIDER); _c2 = Cipher.getInstance(ALG_NAME, PROVIDER); _c3 = Cipher.getInstance(ALG_NAME, PROVIDER); } catch(NoSuchAlgorithmException ex1) { throw new InternalError("Unreachable code reached."); } catch(NoSuchPaddingException ex2) { throw new InternalError("Unreachable code reached."); } catch(NoSuchProviderException ex3) { throw new InternalError("Unreachable code reached."); } } /** * Always throws a CloneNotSupportedException (cloning of ciphers is not * supported for security reasons). */ public final Object clone() throws CloneNotSupportedException { throw new CloneNotSupportedException(); } // CipherSPI implementation //............................................................................ protected final void engineSetMode(String mode) throws NoSuchAlgorithmException { if(!mode.equals("InnerCBC")) throw new NoSuchAlgorithmException(mode); } protected final void engineSetPadding(String padding) throws NoSuchPaddingException { if(!padding.equals("None")) throw new NoSuchPaddingException(padding); } protected final int engineGetBlockSize() { return BLOCK_SIZE; } protected int engineGetKeySize(Key key) throws InvalidKeyException { if( key==null ) throw new IllegalArgumentException("Key missing"); if( !key.getFormat().equalsIgnoreCase("RAW") ) throw new InvalidKeyException("Wrong format: RAW bytes needed"); byte[] userkey = key.getEncoded(); if(userkey == null) throw new InvalidKeyException("RAW bytes missing"); return (userkey.length * 8); } /** * Returns the length in bytes that an output buffer would need to be in * order to hold the result of the next update or doFinal operation, given * the input length <code>inputLen</code> (in bytes). * * This call takes into account any unprocessed (buffered) data from a * previous update call(s), and padding. * * The actual output length of the next <code>update or doFinal</code> call * may be smaller than the length returned by this method. For ciphers with * a padding, calling the update method will generally return less data * than predicted by this function. * * @param inputLen the length in bytes. * * @return the maximum amount of data that the cipher will return. */ protected final int engineGetOutputSize(int len) { // result is exact because the three ciphers don't use padding return _c1.getOutputSize(_c2.getOutputSize(_c3.getOutputSize(len))); } /** * Returns a copy of the initialization vector (IV) used in this cipher. * * @return A copy of the IV or null if this cipher does not have an IV or * null if the IV has not yet been set. */ protected final byte[] engineGetIV() { return (byte[])_ivBuf.clone(); } protected final AlgorithmParameters engineGetParameters() { return new IvParameterSpec(engineGetIV()); } protected final void engineInit(int opmode, Key key, SecureRandom random) throws InvalidKeyException { try { engineInit(opmode, key, (AlgorithmParameterSpec)null, random); } catch(InvalidAlgorithmParameterException ex) { throw new InternalError("Unreachable code reached."); } } protected final void engineInit(int opmode, Key key, AlgorithmParameterSpec params, SecureRandom random) throws InvalidKeyException, InvalidAlgorithmParameterException { if(opmode != Cipher.ENCRYPT_MODE && opmode != Cipher.DECRYPT_MODE) throw new IllegalArgumentException("opmode invalid ("+opmode+")"); if(key == null) throw new IllegalArgumentException("key invalid ("+key+")"); byte[] keyBuf = key.getEncoded(); if(keyBuf == null) throw new InvalidKeyException("key.getEncoded() == null"); if(keyBuf.length != KEY_SIZE) throw new InvalidKeyException("Invalid key length"); Key k1 = new RawSecretKey("DES", keyBuf, 0, 8); Key k2 = new RawSecretKey("DES", keyBuf, 8, 8); Key k3 = new RawSecretKey("DES", keyBuf, 16, 8); if(params == null) { _ivBuf = new byte[IV_SIZE]; random.nextBytes(_ivBuf); } else if(params instanceof IvParameterSpec) { _ivBuf = ((IvParameterSpec)params).getIV(); if(_ivBuf.length != IV_SIZE) throw new InvalidAlgorithmParameterException("IV too short"); } else { throw new InvalidAlgorithmParameterException("params = "+params); } IvParameterSpec iv1 = new IvParameterSpec(_ivBuf, 0, 8); IvParameterSpec iv2 = new IvParameterSpec(_ivBuf, 8, 8); IvParameterSpec iv3 = new IvParameterSpec(_ivBuf, 16, 8); if(opmode == Cipher.ENCRYPT_MODE) { _c1.init(Cipher.ENCRYPT_MODE, k1, iv1, random); _c2.init(Cipher.DECRYPT_MODE, k2, iv2, random); _c3.init(Cipher.ENCRYPT_MODE, k3, iv3, random); } else { _c1.init(Cipher.DECRYPT_MODE, k3, iv3, random); _c2.init(Cipher.ENCRYPT_MODE, k2, iv2, random); _c3.init(Cipher.DECRYPT_MODE, k1, iv1, random); } } protected final void engineInit(int opmode, Key key, AlgorithmParameters params, SecureRandom random) throws InvalidKeyException, InvalidAlgorithmParameterException { if(params != null) throw new InvalidAlgorithmParameterException(); engineInit(opmode, key, (AlgorithmParameterSpec)null, random); } protected final int engineUpdate(byte[] in, int inOff, int inLen, byte[] out, int outOff) throws ShortBufferException { int outLen; outLen = _c1.update(in, inOff, inLen, out, outOff); outLen = _c2.update(out, outOff, outLen, out, outOff); outLen = _c3.update(out, outOff, outLen, out, outOff); return outLen; } protected final byte[] engineUpdate(byte[] in, int inOff, int inLen) { byte[] buf; buf = _c1.update(in, inOff, inLen); buf = _c2.update(buf, 0, buf.length); buf = _c3.update(buf, 0, buf.length); return buf; } /** * @throws BadPaddingException * (decryption only) if padding is expected but not found at the * end of the data or the padding is found but corrupt * @throws IllegalBlockSizeException * if no padding is specified and the input data is not a multiple * of the blocksize. * @throws ShortBufferException if the given buffer is to short to hold * the result. */ protected final int engineDoFinal(byte[] in, int inOff, int inLen, byte[] out, int outOff) throws ShortBufferException, IllegalBlockSizeException, BadPaddingException { int outLen; outLen = _c1.doFinal(in, inOff, inLen, out, outOff); outLen = _c2.doFinal(out, outOff, outLen, out, outOff); outLen = _c3.doFinal(out, outOff, outLen, out, outOff); return outLen; } /** * Implemented in terms of engineDoFinal(byte[], int, int, byte[], int) * * @throws BadPaddingException * (decryption only) if padding is expected but not found at the * end of the data. * @throws IllegalBlockSizeException * if no padding is specified and the input data is not a multiple * of the blocksize. */ protected final byte[] engineDoFinal(byte[] in, int inOff, int inLen) throws IllegalBlockSizeException, BadPaddingException { byte[] buf; buf = _c1.doFinal(in, inOff, inLen); buf = _c2.doFinal(buf, 0, buf.length); buf = _c3.doFinal(buf, 0, buf.length); return buf; } } |
From: <gel...@mx...> - 2003-02-20 02:37:11
|
gelderen 03/02/19 21:45:16 Modified: jce/src/cryptix.jce.test TestRSA_OAEP.java Log: - Expand a little on the RSA-OAEP test. Revision Changes Path 1.4 +32 -8 projects/jce/src/cryptix.jce.test/TestRSA_OAEP.java Index: TestRSA_OAEP.java =================================================================== RCS file: /home/cryptix-cvs/cvsroot/projects/jce/src/cryptix.jce.test/TestRSA_OAEP.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- TestRSA_OAEP.java 17 Feb 2003 18:28:07 -0000 1.3 +++ TestRSA_OAEP.java 20 Feb 2003 02:45:16 -0000 1.4 @@ -1,4 +1,4 @@ -/* $Id: TestRSA_OAEP.java,v 1.3 2003/02/17 18:28:07 gelderen Exp $ +/* $Id: TestRSA_OAEP.java,v 1.4 2003/02/20 02:45:16 gelderen Exp $ * * Copyright (C) 1995-2000 The Cryptix Foundation Limited. * All rights reserved. @@ -98,7 +98,14 @@ protected void doIt() throws Exception { - beginTest("Begin"); + doTest1(); + doTest2(); + } + + + protected void doTest1() throws Exception { + + beginTest("Test Vectors"); RSAPublicKey pub = new RSAPublicKey() { public BigInteger getModulus() { @@ -124,8 +131,6 @@ public byte[] getEncoded() { return null; } }; - - SecureRandom rng = new InsecureRandom(Util.hexFromString(SD)); byte[] pt = Util.hexFromString(PT); @@ -138,8 +143,21 @@ byte[] pt1 = c.doFinal(ct); passIf(Util.areEqual(pt, pt1)); + } + + + protected void doTest2() throws Exception { + int ROUNDS = 100; + beginTest(ROUNDS + " Random Keys"); + + for(int i=0; i<ROUNDS; i++) + cryptWithRandomKey(); -/* + passIf(true); + } + + + private void cryptWithRandomKey() throws Exception { KeyPairGenerator kpg = KeyPairGenerator.getInstance(KALG, PROVIDER); kpg.initialize(SIZE); @@ -149,8 +167,14 @@ Cipher c = Cipher.getInstance(ALG, PROVIDER); c.init(Cipher.ENCRYPT_MODE, pub); - byte[] ct = c.doFinal(PT); - passIf(true); -*/ + byte[] pt = Util.hexFromString(PT); + byte[] ct = c.doFinal(pt); + + c = Cipher.getInstance(ALG, PROVIDER); + c.init(Cipher.DECRYPT_MODE, priv); + byte[] pt1 = c.doFinal(ct); + + if(!Util.areEqual(pt, pt1)) + throw new Exception("Failed!"); } } |
From: <gel...@mx...> - 2003-02-20 02:35:41
|
gelderen 03/02/19 21:43:39 Modified: jce/src/cryptix.jce.provider.rsa RSACipher_OAEP.java Log: - Catch problems caused by invalid keys. (ArithmeticException and invalid block lengths.) Revision Changes Path 1.2 +20 -8 projects/jce/src/cryptix.jce.provider.rsa/RSACipher_OAEP.java Index: RSACipher_OAEP.java =================================================================== RCS file: /home/cryptix-cvs/cvsroot/projects/jce/src/cryptix.jce.provider.rsa/RSACipher_OAEP.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- RSACipher_OAEP.java 7 Feb 2003 15:08:32 -0000 1.1 +++ RSACipher_OAEP.java 20 Feb 2003 02:43:39 -0000 1.2 @@ -1,4 +1,4 @@ -/* $Id: RSACipher_OAEP.java,v 1.1 2003/02/07 15:08:32 gelderen Exp $ +/* $Id: RSACipher_OAEP.java,v 1.2 2003/02/20 02:43:39 gelderen Exp $ * * Copyright (C) 2002, 2003 The Cryptix Foundation Limited. * All rights reserved. @@ -41,7 +41,7 @@ /** * @author Jeroen C. van Gelderen (gel...@cr...) - * @version $Revision: 1.1 $ + * @version $Revision: 1.2 $ */ public abstract class RSACipher_OAEP extends CipherSpi { @@ -266,13 +266,19 @@ // integer message representative m = RSADP (K, c) . // If RSADP outputs "ciphertext representative out of range" // (meaning that c >= n), output "decryption error" and stop. - BigInteger m = RSAAlgorithm.rsa(c, _n, _exp, _p, _q, _u); - // XXX: handle errors (bad key) + BigInteger m = null; + try { + m = RSAAlgorithm.rsa(c, _n, _exp, _p, _q, _u); + } catch(ArithmeticException ex) { + throw new BadPaddingException( + "ArithmeticException during decrypt! Bad key perhaps?"); + } // c. Convert the message representative m to an encoded message // EM of length k octets: EM = I2OSP (m, k) . byte[] EM = Util.toFixedLenByteArray(m, _k); - // XXX: handle m too long (bad key) + if(EM.length != _k) + throw new BadPaddingException(); // 3. EME-OAEP decoding: // a. If the label L is not provided, let L be the empty string. @@ -389,13 +395,19 @@ // b. Apply the RSAEP encryption primitive to the RSA public // key (n, e) and the message representative m to produce an // integer ciphertext representative c: c = RSAEP ((n, e), m) . - BigInteger c = RSAAlgorithm.rsa(m, _n, _exp, _p, _q, _u); - // XXX: handle error (bad key) + BigInteger c = null; + try { + c = RSAAlgorithm.rsa(m, _n, _exp, _p, _q, _u); + } catch(ArithmeticException ex) { + throw new IllegalBlockSizeException( + "ArithmeticException during encrypt! Bad key perhaps?"); + } // c. Convert the ciphertext representative c to a ciphertext C // of length k octets C = I2OSP (c, k) . byte[] C = Util.toFixedLenByteArray(c, _k); - // XXX: handle error (bad key) + if(C.length != _k) + throw new IllegalBlockSizeException(); // 4. Output the ciphertext C. return C; |
From: <gel...@mx...> - 2003-02-17 18:27:04
|
gelderen 03/02/17 13:35:09 Modified: jce/doc ChangeLog.txt Log: 2003 02 17 Revision Changes Path 1.3 +8 -0 projects/jce/doc/ChangeLog.txt Index: ChangeLog.txt =================================================================== RCS file: /home/cryptix-cvs/cvsroot/projects/jce/doc/ChangeLog.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- ChangeLog.txt 15 Feb 2003 13:49:19 -0000 1.2 +++ ChangeLog.txt 17 Feb 2003 18:35:09 -0000 1.3 @@ -1,6 +1,14 @@ Change Log +2003 02 17 + +- Slightly improve RSA_OAEP test: verify output and remove printlns. + +- Use a larger key size in the ElGamal test. + +- Add engineGetKeySize implementations to RSA_PKCS and ElGamal ciphers. + 2003 02 15 - Bandaid for the AlgorithmParameters test: explicitly limit ourselves |
From: <gel...@mx...> - 2003-02-17 18:20:01
|
gelderen 03/02/17 13:28:07 Modified: jce/src/cryptix.jce.test TestRSA_OAEP.java Log: - Actually check the results! Revision Changes Path 1.3 +3 -2 projects/jce/src/cryptix.jce.test/TestRSA_OAEP.java Index: TestRSA_OAEP.java =================================================================== RCS file: /home/cryptix-cvs/cvsroot/projects/jce/src/cryptix.jce.test/TestRSA_OAEP.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- TestRSA_OAEP.java 17 Feb 2003 18:26:09 -0000 1.2 +++ TestRSA_OAEP.java 17 Feb 2003 18:28:07 -0000 1.3 @@ -1,4 +1,4 @@ -/* $Id: TestRSA_OAEP.java,v 1.2 2003/02/17 18:26:09 gelderen Exp $ +/* $Id: TestRSA_OAEP.java,v 1.3 2003/02/17 18:28:07 gelderen Exp $ * * Copyright (C) 1995-2000 The Cryptix Foundation Limited. * All rights reserved. @@ -137,6 +137,8 @@ c.init(Cipher.DECRYPT_MODE, priv, rng); byte[] pt1 = c.doFinal(ct); + passIf(Util.areEqual(pt, pt1)); + /* KeyPairGenerator kpg = KeyPairGenerator.getInstance(KALG, PROVIDER); kpg.initialize(SIZE); @@ -150,6 +152,5 @@ byte[] ct = c.doFinal(PT); passIf(true); */ - passIf(true); } } |
From: <gel...@mx...> - 2003-02-17 18:18:04
|
gelderen 03/02/17 13:26:09 Modified: jce/src/cryptix.jce.test TestRSA_OAEP.java Log: - Remove debug prints. Revision Changes Path 1.2 +1 -4 projects/jce/src/cryptix.jce.test/TestRSA_OAEP.java Index: TestRSA_OAEP.java =================================================================== RCS file: /home/cryptix-cvs/cvsroot/projects/jce/src/cryptix.jce.test/TestRSA_OAEP.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- TestRSA_OAEP.java 7 Feb 2003 15:07:42 -0000 1.1 +++ TestRSA_OAEP.java 17 Feb 2003 18:26:09 -0000 1.2 @@ -1,4 +1,4 @@ -/* $Id: TestRSA_OAEP.java,v 1.1 2003/02/07 15:07:42 gelderen Exp $ +/* $Id: TestRSA_OAEP.java,v 1.2 2003/02/17 18:26:09 gelderen Exp $ * * Copyright (C) 1995-2000 The Cryptix Foundation Limited. * All rights reserved. @@ -134,12 +134,9 @@ c.init(Cipher.ENCRYPT_MODE, pub, rng); byte[] ct = c.doFinal(pt); - System.out.println(Util.toString(ct)); - c.init(Cipher.DECRYPT_MODE, priv, rng); byte[] pt1 = c.doFinal(ct); - System.out.println(Util.toString(pt1)); /* KeyPairGenerator kpg = KeyPairGenerator.getInstance(KALG, PROVIDER); kpg.initialize(SIZE); |
From: <gel...@mx...> - 2003-02-17 18:17:29
|
gelderen 03/02/17 13:25:35 Modified: jce/src/cryptix.jce.provider.elgamal ElGamalCipher.java Log: -Add engineGetKeySize implementation. Revision Changes Path 1.10 +12 -2 projects/jce/src/cryptix.jce.provider.elgamal/ElGamalCipher.java Index: ElGamalCipher.java =================================================================== RCS file: /home/cryptix-cvs/cvsroot/projects/jce/src/cryptix.jce.provider.elgamal/ElGamalCipher.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- ElGamalCipher.java 7 Feb 2003 15:14:55 -0000 1.9 +++ ElGamalCipher.java 17 Feb 2003 18:25:35 -0000 1.10 @@ -1,4 +1,4 @@ -/* $Id: ElGamalCipher.java,v 1.9 2003/02/07 15:14:55 gelderen Exp $ +/* $Id: ElGamalCipher.java,v 1.10 2003/02/17 18:25:35 gelderen Exp $ * * Copyright (C) 1995-2000 The Cryptix Foundation Limited. * All rights reserved. @@ -43,7 +43,7 @@ * * @author Paul Waserbrot (pw...@cr...) * @author Kevin Dana, Agorics Inc. (Agorics mod: 16273) - * @version $Revision: 1.9 $ + * @version $Revision: 1.10 $ */ public final class ElGamalCipher extends CipherSpi { @@ -89,6 +89,16 @@ //we should use p.bitLength() rounded up instead of messageMaxLength //which is rounded down. return ((p.bitLength() + 7) / 8) * 2; + } + + + protected int engineGetKeySize(Key key) throws InvalidKeyException { + + if( !(key instanceof ElGamalKey) ) + throw new InvalidKeyException("Not an ElGamalKey!"); + + ElGamalParams params = ((ElGamalKey)key).getParams(); + return params.getP().bitLength(); } |
From: <gel...@mx...> - 2003-02-17 18:17:13
|
gelderen 03/02/17 13:25:19 Modified: jce/src/cryptix.jce.provider.rsa RSACipher_ECB_PKCS1.java Log: -Add engineGetKeySize implementation. Revision Changes Path 1.12 +13 -12 projects/jce/src/cryptix.jce.provider.rsa/RSACipher_ECB_PKCS1.java Index: RSACipher_ECB_PKCS1.java =================================================================== RCS file: /home/cryptix-cvs/cvsroot/projects/jce/src/cryptix.jce.provider.rsa/RSACipher_ECB_PKCS1.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- RSACipher_ECB_PKCS1.java 15 Jan 2003 21:07:51 -0000 1.11 +++ RSACipher_ECB_PKCS1.java 17 Feb 2003 18:25:19 -0000 1.12 @@ -1,4 +1,4 @@ -/* $Id: RSACipher_ECB_PKCS1.java,v 1.11 2003/01/15 21:07:51 gelderen Exp $ +/* $Id: RSACipher_ECB_PKCS1.java,v 1.12 2003/02/17 18:25:19 gelderen Exp $ * * Copyright (C) 1995-2000 The Cryptix Foundation Limited. * All rights reserved. @@ -39,7 +39,7 @@ * <B>Please read the comments in the source.</B> * * @author Paul Waserbrot (pw...@cr...) - * @version $Revision: 1.11 $ + * @version $Revision: 1.12 $ */ public final class RSACipher_ECB_PKCS1 extends CipherSpi { @@ -301,17 +301,18 @@ } } - - /* - * Should we implement this one?? (pw) - protected int - engineGetKeySize(Key key) - throws InvalidKeyException { - throw new UnsupportedOperationException( - "Not implemented by the provider!"); + + protected int engineGetKeySize(Key key) throws InvalidKeyException { + + if(key instanceof RSAPublicKey) + return ((RSAPublicKey)key).getModulus().bitLength(); + else if(key instanceof RSAPrivateKey) + return ((RSAPrivateKey)key).getModulus().bitLength(); + else + throw new InvalidKeyException("Not an RSA key."); } - */ - + + /* * Private methods below. * |
From: <gel...@mx...> - 2003-02-17 18:16:47
|
gelderen 03/02/17 13:24:43 Modified: jce/src/cryptix.jce.test TestElGamal.java Log: Use larger key size. Revision Changes Path 1.2 +3 -4 projects/jce/src/cryptix.jce.test/TestElGamal.java Index: TestElGamal.java =================================================================== RCS file: /home/cryptix-cvs/cvsroot/projects/jce/src/cryptix.jce.test/TestElGamal.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- TestElGamal.java 26 Feb 2001 16:27:15 -0000 1.1 +++ TestElGamal.java 17 Feb 2003 18:24:43 -0000 1.2 @@ -1,4 +1,4 @@ -/* $Id: TestElGamal.java,v 1.1 2001/02/26 16:27:15 gelderen Exp $ +/* $Id: TestElGamal.java,v 1.2 2003/02/17 18:24:43 gelderen Exp $ * * Copyright (C) 2000 The Cryptix Foundation Limited. * All rights reserved. @@ -28,7 +28,7 @@ * Very crude testing class, should be expanded lot. * TODO: add testvectors. * - * @version $Revision: 1.1 $ + * @version $Revision: 1.2 $ * @author Erwin van der Koogh (er...@cr...) */ @@ -60,8 +60,7 @@ try { KeyPairGenerator gen = KeyPairGenerator.getInstance("ElGamal"); - gen.initialize(512, - new SecureRandom(("" + System.currentTimeMillis()).getBytes())); + gen.initialize(2048, new SecureRandom()); kp = gen.generateKeyPair(); |
From: <ed...@mx...> - 2003-02-16 11:15:50
|
edwin 03/02/16 06:23:55 Modified: openpgp/lib cryptix-jce-api.jar cryptix-jce-provider.jar Log: 20030215 release. |
From: <ed...@mx...> - 2003-02-16 11:00:17
|
edwin 03/02/16 06:08:23 Modified: openpgp CHANGELOG.TXT Log: Update Revision Changes Path 1.19 +5 -1 projects/openpgp/CHANGELOG.TXT Index: CHANGELOG.TXT =================================================================== RCS file: /home/cryptix-cvs/cvsroot/projects/openpgp/CHANGELOG.TXT,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- CHANGELOG.TXT 14 Feb 2003 12:37:31 -0000 1.18 +++ CHANGELOG.TXT 16 Feb 2003 11:08:23 -0000 1.19 @@ -2,7 +2,11 @@ - Snapshots are now compiled on JDK 1.2, so that they continue to work on that version of the JDK. Due to a Sun API change, a library compiled on JDK 1.3 or higher would not work on JDK 1.2. -- Fixed the clone() method of PGPKeyBundleImpl +- Change the getEncoded() method of a PGP certificate to encode the + public key and principal that are signed as well. This is more like + what other Certificate implementations do, and it also allows one to + construct a KeyBundle from the returned data again. +- Fix the clone() method of PGPKeyBundleImpl. 20030205 snapshot - API change: added cryptix.pki.ExtendedCertificate, which adds a few common |
From: <ed...@mx...> - 2003-02-16 10:59:16
|
edwin 03/02/16 06:07:19 Modified: openpgp/src/cryptix/openpgp/provider PGPCertificateImpl.java Log: - Change the getEncoded() method of a PGP certificate to encode the public key and principal that are signed as well. This is more like what other Certificate implementations do, and it also allows one to construct a KeyBundle from the returned data again. Revision Changes Path 1.4 +4 -2 projects/openpgp/src/cryptix/openpgp/provider/PGPCertificateImpl.java Index: PGPCertificateImpl.java =================================================================== RCS file: /home/cryptix-cvs/cvsroot/projects/openpgp/src/cryptix/openpgp/provider/PGPCertificateImpl.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- PGPCertificateImpl.java 4 Feb 2003 13:22:03 -0000 1.3 +++ PGPCertificateImpl.java 16 Feb 2003 11:07:19 -0000 1.4 @@ -1,4 +1,4 @@ -/* $Id: PGPCertificateImpl.java,v 1.3 2003/02/04 13:22:03 edwin Exp $ +/* $Id: PGPCertificateImpl.java,v 1.4 2003/02/16 11:07:19 edwin Exp $ * * Copyright (C) 1999-2001 The Cryptix Foundation Limited. * All rights reserved. @@ -70,7 +70,7 @@ * An OpenPGP Certificate. * * @author Edwin Woudt <ed...@cr...> - * @version $Revision: 1.3 $ + * @version $Revision: 1.4 $ */ public class PGPCertificateImpl extends PGPCertificate { @@ -158,6 +158,8 @@ try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); + key.getPacket().encode(baos); + subject.getPacket().encode(baos); pkt.encode(baos); baos.close(); return baos.toByteArray(); |
From: <ed...@mx...> - 2003-02-16 10:57:34
|
edwin 03/02/16 06:05:41 Modified: openpgp/src/cryptix/openpgp package.html Added: openpgp/src/cryptix/message package.html openpgp/src/cryptix/pki package.html Log: Doco update Revision Changes Path 1.1 projects/openpgp/src/cryptix/message/package.html Index: package.html =================================================================== <HTML> <BODY> <P>The Cryptix Message API.</P> </BODY> </HTML> 1.1 projects/openpgp/src/cryptix/pki/package.html Index: package.html =================================================================== <HTML> <BODY> <P>The Cryptix PKI API.</P> </BODY> </HTML> 1.2 +1 -2 projects/openpgp/src/cryptix/openpgp/package.html Index: package.html =================================================================== RCS file: /home/cryptix-cvs/cvsroot/projects/openpgp/src/cryptix/openpgp/package.html,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- package.html 19 Jul 2000 18:34:20 -0000 1.1 +++ package.html 16 Feb 2003 11:05:40 -0000 1.2 @@ -1,6 +1,5 @@ <HTML> <BODY> -<P>High-level classes for encryption, decryption, signing, verification and -key management.</P> +<P>OpenPGP specific extensions to the Message and PKI API's.</P> </BODY> </HTML> |
From: <ed...@mx...> - 2003-02-16 10:53:58
|
edwin 03/02/16 06:02:03 Modified: openpgp build.xml Log: Add a cleanclasses targets, which amongst others leaves the generated javadoc alone (unlike 'clean'). Revision Changes Path 1.26 +4 -0 projects/openpgp/build.xml Index: build.xml =================================================================== RCS file: /home/cryptix-cvs/cvsroot/projects/openpgp/build.xml,v retrieving revision 1.25 retrieving revision 1.26 diff -u -r1.25 -r1.26 --- build.xml 31 Jan 2003 07:00:16 -0000 1.25 +++ build.xml 16 Feb 2003 11:02:03 -0000 1.26 @@ -35,6 +35,10 @@ <delete dir="${build}" quiet="true"/> </target> + <target name="cleanclasses"> + <delete dir="${build.classes}" quiet="true"/> + </target> + <!-- Compilation ........................................................... --> |
From: <gel...@mx...> - 2003-02-15 13:41:12
|
gelderen 03/02/15 08:49:19 Modified: jce/doc ChangeLog.txt Log: 2003 02 15 Changes Revision Changes Path 1.2 +29 -9 projects/jce/doc/ChangeLog.txt Index: ChangeLog.txt =================================================================== RCS file: /home/cryptix-cvs/cvsroot/projects/jce/doc/ChangeLog.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- ChangeLog.txt 7 Feb 2003 15:13:27 -0000 1.1 +++ ChangeLog.txt 15 Feb 2003 13:49:19 -0000 1.2 @@ -1,18 +1,27 @@ Change Log +2003 02 15 -2003 01 05 +- Bandaid for the AlgorithmParameters test: explicitly limit ourselves + to the CryptixCrypto provider. This may or may not be the right + solution. -- Fix IllegalStateException from RawKeyGenerator.engineGenerateKey() - when trying to generate a SecretKey with the default length. - (Kevin Dana / Agorics Inc.) +- Moved cryptix.jce.util.Group and cryptix.jce.util.Precomputed to + cryptix.jce.provider.util. This allows DH and ElGamal to function + when cryptix-jce-api.jar is not in the CLASSPATH. -- Fix ClassCastException from CoreInit() method of Mode instance when - using RC2 cipher algorithm. - (Kevin Dana / Agorics Inc.) +- Add test case for RC4. + +- Hack CipherTest up a bit to allow for testing stream ciphers. + +- Remove RIPEMD from test list, the test does not exist. + +- Add engineGetKeySize implementations to the symmetric ciphers. + +- Enable RSA_OAEP test. -2003 01 07 +2003 02 07 - ElGamal: Attempt to decrypt with wrong key can produce an ArrayIndexOutofBoundsException. @@ -21,5 +30,16 @@ - Added implementation of RSAES-OAEP. (Jeroen C. van Gelderen / Cryptix) -- Added partial implementation of InscureRandom, a fixed-sequence +- Added partial implementation of InsecureRandom, a fixed-sequence implementation of the SecureRandom interface. + +2003 02 05 + +- Fix IllegalStateException from RawKeyGenerator.engineGenerateKey() + when trying to generate a SecretKey with the default length. + (Kevin Dana / Agorics Inc.) + +- Fix ClassCastException from CoreInit() method of Mode instance when + using RC2 cipher algorithm. + (Kevin Dana / Agorics Inc.) + |
From: <gel...@mx...> - 2003-02-15 13:40:36
|
gelderen 03/02/15 08:48:43 Modified: jce/src/cryptix.jce.test Test.java Log: - Remove RIPEMD from test list, the test does not exist. - Enable RSA_OAEP test. - Add test case for RC4. Revision Changes Path 1.23 +6 -5 projects/jce/src/cryptix.jce.test/Test.java Index: Test.java =================================================================== RCS file: /home/cryptix-cvs/cvsroot/projects/jce/src/cryptix.jce.test/Test.java,v retrieving revision 1.22 retrieving revision 1.23 diff -u -r1.22 -r1.23 --- Test.java 10 Oct 2001 02:58:12 -0000 1.22 +++ Test.java 15 Feb 2003 13:48:43 -0000 1.23 @@ -1,4 +1,4 @@ -/* $Id: Test.java,v 1.22 2001/10/10 02:58:12 gelderen Exp $ +/* $Id: Test.java,v 1.23 2003/02/15 13:48:43 gelderen Exp $ * * Copyright (C) 1995-2000 The Cryptix Foundation Limited. * All rights reserved. @@ -15,7 +15,7 @@ { private static final String CLASS_PREFIX = "cryptix.jce.test.Test", - VERSION = "$Revision: 1.22 $"; + VERSION = "$Revision: 1.23 $"; private static boolean verbose=true; @@ -23,14 +23,14 @@ { "DSA", - "MD2", "MD4", "MD5", "RIPEMD", "RIPEMD128", "RIPEMD160", + "MD2", "MD4", "MD5", "RIPEMD128", "RIPEMD160", "SHA0", "SHA1", "SHA256", "SHA384", "SHA512", "Tiger", - "Blowfish", "CAST5", "DES","IDEA", "MARS", "Null", "RC2", "RC6", + "Blowfish", "CAST5", "DES","IDEA", "MARS", "Null", "RC2", "RC4", "RC6", "Rijndael", "Serpent", "SKIPJACK", "Square", "TripleDES", "Twofish", - "RSA_ECB_PKCS1", "ElGamal", + "RSA_ECB_PKCS1", "RSA_OAEP", "ElGamal", "ModeAndPadding", "AlgorithmParameters", "CipherStream", "SealedObject" }; @@ -70,6 +70,7 @@ catch(ClassNotFoundException e) { System.out.println("Test not found."); + e.printStackTrace(); System.exit(1); } catch(Throwable t) |
From: <gel...@mx...> - 2003-02-15 13:39:05
|
gelderen 03/02/15 08:47:11 Modified: jce/src/cryptix.jce.test CipherTest.java Log: - Hack CipherTest up a bit to allow for testing stream ciphers. Revision Changes Path 1.11 +26 -6 projects/jce/src/cryptix.jce.test/CipherTest.java Index: CipherTest.java =================================================================== RCS file: /home/cryptix-cvs/cvsroot/projects/jce/src/cryptix.jce.test/CipherTest.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- CipherTest.java 6 Aug 2001 21:22:55 -0000 1.10 +++ CipherTest.java 15 Feb 2003 13:47:10 -0000 1.11 @@ -1,4 +1,4 @@ -/* $Id: CipherTest.java,v 1.10 2001/08/06 21:22:55 edwin Exp $ +/* $Id: CipherTest.java,v 1.11 2003/02/15 13:47:10 gelderen Exp $ * * Copyright (C) 1995-2000 The Cryptix Foundation Limited. * All rights reserved. @@ -25,12 +25,23 @@ private static SecureRandom random = new SecureRandom(); private final String alg; + + private final boolean testStreamCipher; protected CipherTest(String name) { super(name); - alg = name; + this.alg = name; + this.testStreamCipher = false; + } + + + protected CipherTest(String name, boolean testStreamCipher) + { + super(name); + this.alg = name; + this.testStreamCipher = testStreamCipher; } @@ -98,8 +109,12 @@ byte[] key = Util.hexFromString(testValues[i][0]); byte[] pt = Util.hexFromString(testValues[i][1]); byte[] ct = Util.hexFromString(testValues[i][2]); - - Cipher c = Cipher.getInstance(alg+"/ECB/None", "CryptixCrypto"); + + String transform = alg+"/ECB/None"; + if(testStreamCipher) + transform = alg; + + Cipher c = Cipher.getInstance(transform, "CryptixCrypto"); c.init( Cipher.ENCRYPT_MODE, new K(alg, key) ); byte[] trial_ct = c.doFinal(pt); @@ -154,9 +169,14 @@ beginTest("KeyGenerator works"); try { - KeyGenerator keygen = KeyGenerator.getInstance(alg, "CryptixCrypto"); + KeyGenerator keygen = KeyGenerator.getInstance(alg,"CryptixCrypto"); keygen.init(random); - Cipher c = Cipher.getInstance(alg+"/ECB/None", "CryptixCrypto"); // FIXME remove /ecb/none + + String transform = alg+"/ECB/None"; + if(testStreamCipher) + transform = alg; + + Cipher c = Cipher.getInstance(transform, "CryptixCrypto"); int block_size = c.getBlockSize(); byte[] pt = new byte[block_size]; for(int i=0; i<pt.length; i++) |