|
From: <pe...@us...> - 2003-12-18 17:40:22
|
Update of /cvsroot/neuclear/neuclear-id/src/test/org/neuclear/id/jce
In directory sc8-pr-cvs1:/tmp/cvs-serv29659/src/test/org/neuclear/id/jce
Modified Files:
NeuClearJCETest.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.
Index: NeuClearJCETest.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/test/org/neuclear/id/jce/NeuClearJCETest.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** NeuClearJCETest.java 17 Dec 2003 18:02:44 -0000 1.8
--- NeuClearJCETest.java 18 Dec 2003 17:40:19 -0000 1.9
***************
*** 4,8 ****
--- 4,11 ----
import org.neuclear.commons.crypto.passphraseagents.AlwaysTheSamePassphraseAgent;
import org.neuclear.commons.crypto.signers.JCESigner;
+ import org.neuclear.commons.crypto.CryptoException;
+ import org.neuclear.commons.crypto.CryptoTools;
import org.neuclear.id.Identity;
+ import org.neuclear.id.InvalidNamedObjectException;
import org.neuclear.id.builders.AuthenticationTicketBuilder;
import org.neuclear.id.builders.IdentityBuilder;
***************
*** 39,42 ****
--- 42,50 ----
$Id$
$Log$
+ Revision 1.9 2003/12/18 17:40:19 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.8 2003/12/17 18:02:44 pelle
NeuClear JCE Certificates now work with KeyStore.
***************
*** 90,93 ****
--- 98,103 ----
*/
public final class NeuClearJCETest extends AbstractSigningTest {
+ static final String IVAN = "neu://ivan@test";
+
public NeuClearJCETest(final String string) throws NeuClearException, GeneralSecurityException {
super(string);
***************
*** 180,183 ****
--- 190,216 ----
//authb.sign(sig2);
+ }
+ public void testCreateAndUpdateCert() throws NeuClearException, XMLException {
+ PublicKey pub=getSigner().generateKey(IVAN);
+ assertNotNull(pub);
+ final IdentityBuilder id = new IdentityBuilder(IVAN,pub);
+ assertEquals(IVAN,id.getName());
+ assertTrue(signer.canSignFor(IVAN));
+ assertNotNull(signer.getPublicKey(IVAN));
+ assertEquals(pub,signer.getPublicKey(IVAN));
+ try {
+ final Identity ivan = (Identity) id.convert();
+ assertNotNull(ivan);
+ assertEquals(IVAN,ivan.getName());
+ assertNotNull(ivan.getPublicKey());
+ assertEquals(pub,ivan.getCertificate().getPublicKey());
+ assertEquals(ivan.getPublicKey(),signer.getPublicKey(IVAN));
+ final byte[] data = "this is a test".getBytes();
+ final byte[] sig = signer.sign(IVAN, data);
+ assertNotNull(sig);
+ assertTrue(CryptoTools.verify(ivan.getPublicKey(), data, sig));
+ } catch (InvalidNamedObjectException e) {
+ assertTrue("The Signature was invalid",false);
+ }
}
}
|