Update of /cvsroot/neuclear/neuclear-commons/src/test/org/neuclear/commons/crypto/signers
In directory sc8-pr-cvs1:/tmp/cvs-serv29525/src/test/org/neuclear/commons/crypto/signers
Modified Files:
SimpleSignerStoreTest.java TestCaseSignerTest.java
Added Files:
JCESignerTest.java
Log Message:
You can now create keys that get stored with a X509 certificate in the keystore. These can be saved as well.
IdentityCreator has been modified to allow creation of keys.
Note The actual Creation of Certificates still have a problem that will be resolved later today.
--- NEW FILE: JCESignerTest.java ---
package org.neuclear.commons.crypto.signers;
import junit.framework.TestCase;
import org.neuclear.commons.crypto.CryptoTools;
import org.neuclear.commons.crypto.passphraseagents.AlwaysTheSamePassphraseAgent;
import org.neuclear.commons.NeuClearException;
import java.io.FileNotFoundException;
import java.io.File;
import java.security.GeneralSecurityException;
/**
* Created by IntelliJ IDEA.
* User: pelleb
* Date: Dec 18, 2003
* Time: 11:55:07 AM
* To change this template use Options | File Templates.
*/
public class JCESignerTest extends TestCase{
static final String FILENAME = "target/testdata/keystores/jcesignertest.jks";
static final String BOB="neu://bob@test";
static final String ALICE="neu://alice@test";
public JCESignerTest(String string) {
super(string);
CryptoTools.ensureProvider();
}
public void testCreateBlank() throws FileNotFoundException, GeneralSecurityException, NeuClearException {
File file=new File(FILENAME);
if (file.exists())
file.delete();// We want to clear out any existing stores
assertFalse(file.exists());
JCESigner signer=new JCESigner(FILENAME,"jks","SUN",new AlwaysTheSamePassphraseAgent("neuclear"));
assertFalse(signer.canSignFor(BOB));
assertFalse(signer.canSignFor(ALICE));
signer.generateKey(BOB);
signer.generateKey(ALICE);
assertTrue(signer.canSignFor(BOB));
assertTrue(signer.canSignFor(ALICE));
signer.save();
assertTrue(file.exists());
JCESigner signer2=new JCESigner(FILENAME,"jks","SUN",new AlwaysTheSamePassphraseAgent("neuclear"));
assertTrue(signer2.canSignFor(BOB));
assertTrue(signer2.canSignFor(ALICE));
}
}
Index: SimpleSignerStoreTest.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-commons/src/test/org/neuclear/commons/crypto/signers/SimpleSignerStoreTest.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** SimpleSignerStoreTest.java 10 Dec 2003 23:55:45 -0000 1.5
--- SimpleSignerStoreTest.java 18 Dec 2003 17:40:08 -0000 1.6
***************
*** 1,4 ****
--- 1,9 ----
/* $Id$
* $Log$
+ * Revision 1.6 2003/12/18 17:40:08 pelle
+ * You can now create keys that get stored with a X509 certificate in the keystore. These can be saved as well.
+ * IdentityCreator has been modified to allow creation of keys.
+ * Note The actual Creation of Certificates still have a problem that will be resolved later today.
+ *
* Revision 1.5 2003/12/10 23:55:45 pelle
* Did some cleaning up in the builders
Index: TestCaseSignerTest.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-commons/src/test/org/neuclear/commons/crypto/signers/TestCaseSignerTest.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** TestCaseSignerTest.java 10 Dec 2003 23:55:45 -0000 1.4
--- TestCaseSignerTest.java 18 Dec 2003 17:40:08 -0000 1.5
***************
*** 29,32 ****
--- 29,37 ----
$Id$
$Log$
+ Revision 1.5 2003/12/18 17:40:08 pelle
+ You can now create keys that get stored with a X509 certificate in the keystore. These can be saved as well.
+ IdentityCreator has been modified to allow creation of keys.
+ Note The actual Creation of Certificates still have a problem that will be resolved later today.
+
Revision 1.4 2003/12/10 23:55:45 pelle
Did some cleaning up in the builders
***************
*** 89,96 ****
assertTrue(CryptoTools.verify(pub, data, sig));
assertTrue(signer.canSignFor(ALIASEVE));
-
-
}
-
private void testKey(final String name) throws CryptoException {
final byte[] sig = signer.sign(name, TESTDATA.getBytes());
--- 94,98 ----
|