|
From: Pelle B. <pe...@us...> - 2004-03-21 00:58:54
|
Update of /cvsroot/neuclear/neuclear-id/src/test/org/neuclear/id In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3012/src/test/org/neuclear/id Modified Files: IdentityTests.java Log Message: The problem with Enveloped signatures has now been fixed. It was a problem in the way transforms work. I have bandaided it, but in the future if better support for transforms need to be made, we need to rethink it a bit. Perhaps using the new crypto channel's in neuclear-commons. Index: IdentityTests.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-id/src/test/org/neuclear/id/IdentityTests.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** IdentityTests.java 20 Mar 2004 17:19:55 -0000 1.7 --- IdentityTests.java 21 Mar 2004 00:48:51 -0000 1.8 *************** *** 54,64 **** public void testAnonymous() throws NoSuchAlgorithmException { - <<<<<<< IdentityTests.java KeyPair kp = CryptoTools.createTinyDSAKeyPair(); Identity id = new Identity(kp.getPublic()); - ======= - KeyPair kp = CryptoTools.createTinyRSAKeyPair(); - Identity id = new Identity(kp.getPublic()); - >>>>>>> 1.6 assertNotNull(id); assertNotNull(id.getName()); --- 54,59 ---- *************** *** 69,73 **** } - <<<<<<< IdentityTests.java public void testEmbedded() throws NoSuchAlgorithmException, XMLSecurityException, CryptoException, NameResolutionException, InvalidNamedObjectException { KeyPair kp = CryptoTools.createTinyDSAKeyPair(); --- 64,67 ---- *************** *** 81,109 **** assertEquals(CryptoTools.encodeBase32(CryptoTools.digest(kp.getPublic().getEncoded())), obj.getName().substring(5, 37)); assertEquals(CryptoTools.encodeBase32(CryptoTools.digest(obj.getEncoded().getBytes())), obj.getName().substring(obj.getName().length() - 32)); - ======= - public void testEmbedded - () throws NoSuchAlgorithmException, XMLSecurityException, CryptoException, NameResolutionException, InvalidNamedObjectException - { - KeyPair kp = CryptoTools.createTinyRSAKeyPair(); - Document doc = DocumentHelper.createDocument(); - Element elem = doc.addElement("TestElement"); - XMLSignature sig = new XMLSignature(kp, elem); - assertEquals(kp.getPublic(), sig.getSignersKey()); - SignedNamedObject obj = VerifyingReader.getInstance().read(elem); - System.out.println("Name: " + obj.getName()); - assertEquals("sha1:", obj.getName().substring(0, 5)); - assertEquals(CryptoTools.encodeBase32(CryptoTools.digest(kp.getPublic().getEncoded())), obj.getName().substring(5, 37)); - assertEquals(CryptoTools.encodeBase32(CryptoTools.digest(obj.getEncoded().getBytes())), obj.getName().substring(obj.getName().length() - 32)); - >>>>>>> 1.6 ! Identity id = obj.getSignatory(); ! assertNotNull(id); ! assertNotNull(id.getName()); ! assertEquals("sha1:", id.getName().substring(0, 5)); ! assertEquals(CryptoTools.encodeBase32(CryptoTools.digest(kp.getPublic().getEncoded())), id.getName().substring(5)); ! assertEquals(kp.getPublic(), id.getPublicKey()); - } } --- 75,88 ---- assertEquals(CryptoTools.encodeBase32(CryptoTools.digest(kp.getPublic().getEncoded())), obj.getName().substring(5, 37)); assertEquals(CryptoTools.encodeBase32(CryptoTools.digest(obj.getEncoded().getBytes())), obj.getName().substring(obj.getName().length() - 32)); ! Identity id = obj.getSignatory(); ! assertNotNull(id); ! assertNotNull(id.getName()); ! assertEquals("sha1:", id.getName().substring(0, 5)); ! assertEquals(CryptoTools.encodeBase32(CryptoTools.digest(kp.getPublic().getEncoded())), id.getName().substring(5)); ! assertEquals(kp.getPublic(), id.getPublicKey()); } + } |