|
From: <pe...@us...> - 2004-01-14 06:42:18
|
Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id
In directory sc8-pr-cvs1:/tmp/cvs-serv29374/src/java/org/neuclear/id
Modified Files:
SignedNamedCore.java
Log Message:
Got rid of the verifyXXX() methods
Index: SignedNamedCore.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/SignedNamedCore.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** SignedNamedCore.java 13 Jan 2004 23:38:26 -0000 1.12
--- SignedNamedCore.java 14 Jan 2004 06:42:15 -0000 1.13
***************
*** 2,5 ****
--- 2,8 ----
* $Id$
* $Log$
+ * Revision 1.13 2004/01/14 06:42:15 pelle
+ * Got rid of the verifyXXX() methods
+ *
* Revision 1.12 2004/01/13 23:38:26 pelle
* Refactoring parts of the core of XMLSignature. There shouldnt be any real API changes.
***************
*** 258,266 ****
import org.neuclear.commons.crypto.CryptoTools;
import org.neuclear.commons.time.TimeTools;
import org.neuclear.id.resolver.NSResolver;
! import org.neuclear.xml.xmlsec.KeyInfo;
! import org.neuclear.xml.xmlsec.XMLSecTools;
! import org.neuclear.xml.xmlsec.XMLSecurityException;
! import org.neuclear.xml.xmlsec.XMLSignature;
import java.security.PublicKey;
--- 261,267 ----
import org.neuclear.commons.crypto.CryptoTools;
import org.neuclear.commons.time.TimeTools;
+ import org.neuclear.commons.LowLevelException;
import org.neuclear.id.resolver.NSResolver;
! import org.neuclear.xml.xmlsec.*;
import java.security.PublicKey;
***************
*** 367,380 ****
private static String encodeElement(final Element elem) {
! return new String(XMLSecTools.canonicalize(elem));
}
private static SignedNamedCore readUnnamed(final Element elem) throws XMLSecurityException, InvalidNamedObjectException {
! final XMLSignature sig=XMLSecTools.getXMLSignature(elem);
! final PublicKey pub = sig.getSignersKey();
! if (sig.verifySignature(pub))
return new SignedNamedCore(pub,encodeElement(elem));
! else
throw new InvalidNamedObjectException("Unnamed object failed Signature verification");
}
--- 368,386 ----
private static String encodeElement(final Element elem) {
! try {
! return new String(XMLSecTools.canonicalize(elem));
! } catch (XMLSecurityException e) {
! throw new LowLevelException(e);
! }
}
private static SignedNamedCore readUnnamed(final Element elem) throws XMLSecurityException, InvalidNamedObjectException {
! try {
! final XMLSignature sig=XMLSecTools.getXMLSignature(elem);
! final PublicKey pub = sig.getSignersKey();
return new SignedNamedCore(pub,encodeElement(elem));
! } catch (InvalidSignatureException e) {
throw new InvalidNamedObjectException("Unnamed object failed Signature verification");
+ }
}
|