|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectedu.internet2.middleware.security.XmlSecTool
public final class XmlSecTool
| Field Summary | |
|---|---|
static int |
RC_INIT
Return code indicating an initialization error, 1 . |
static int |
RC_INVALID_CRED
Return code indicating an error reading the credentials, 6 . |
static int |
RC_INVALID_XML
Return code indicating input XML was not valid, 4 . |
static int |
RC_INVALID_XS
Return code indicating indicating an error validating the XML, 5 . |
static int |
RC_IO
Return code indicating an error reading files, 2 . |
static int |
RC_MALFORMED_XML
Return code indicating the input XML was not well formed, 3 . |
static int |
RC_OK
Return code indicating command completed successfully, 0 . |
static int |
RC_SIG
Return code indicating indicating that signing or signature verification failed, 7 . |
static int |
RC_UNKNOWN
Return code indicating an unknown error occurred, -1 . |
| Constructor Summary | |
|---|---|
XmlSecTool()
|
|
| Method Summary | |
|---|---|
protected static void |
addSignatureELement(XmlSecToolCommandLineArguments cli,
Element root,
Element signature)
Adds the signature element at the appropriate place in the document. |
protected static org.opensaml.xml.security.x509.BasicX509Credential |
getCredential(XmlSecToolCommandLineArguments cli)
Gets the credentials used for signing and signature verification. |
protected static Collection<X509CRL> |
getCRLs(XmlSecToolCommandLineArguments cli)
Gets the CRLs referenced on the command line, if any. |
protected static DocumentBuilder |
getParser(XmlSecToolCommandLineArguments cli)
Constructs a DOM parser used to parse the input XML. |
protected static Element |
getSignatureElement(Document xmlDoc)
Gets the signature element from the document. |
protected static String |
getSignatureReferenceUri(XmlSecToolCommandLineArguments cli,
Element rootElement)
Gets the reference of the URI to use for the signature. |
protected static InputStream |
getXmlInputStreamFromFile(XmlSecToolCommandLineArguments cli)
Creates an input stream that reads the input XML from a file. |
protected static InputStream |
getXmlInputStreamFromUrl(XmlSecToolCommandLineArguments cli)
Creates an input stream that reads the input XML from an HTTP URL. |
protected static void |
initLogging(XmlSecToolCommandLineArguments cli)
Initialize the logging subsystem. |
static void |
main(String[] args)
|
protected static Document |
parseXML(XmlSecToolCommandLineArguments cli)
Parses the input XML from its source and converts it to a DOM document. |
protected static void |
populateKeyInfo(Document doc,
org.apache.xml.security.keys.KeyInfo keyInfo,
org.opensaml.xml.security.x509.BasicX509Credential credential)
Populates an XML signature's KeyInfo with X.509 credential information. |
protected static void |
schemaValidate(XmlSecToolCommandLineArguments cli,
Document xml)
Validates the SAML document against the SAML 1.1 and 2.0 schema. |
protected static void |
sign(XmlSecToolCommandLineArguments cli,
Document xml)
Signs and outputs the signed SAML document. |
protected static void |
validateSignatureReference(Document xmlDocument,
org.apache.xml.security.signature.XMLSignature signature)
Validates the reference within the XML signature by performing the following checks. |
protected static void |
validateSignatureReferenceUri(Document xmlDocument,
org.apache.xml.security.signature.XMLSignature signature,
org.apache.xml.security.signature.Reference reference)
Validates that the element resolved by the signature validation layer's IdResolver is the same as the
element resolved by the DOM layer. |
protected static void |
validateSignatureTransforms(org.apache.xml.security.signature.Reference reference)
Validate the transforms included in the Signature Reference. |
protected static void |
verifySignature(XmlSecToolCommandLineArguments cli,
Document xmlDocument)
Verifies that the signature on a document is valid. |
protected static void |
writeDocument(XmlSecToolCommandLineArguments cli,
Node xml)
Writes a DOM element to the output file. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int RC_OK
public static final int RC_INIT
public static final int RC_IO
public static final int RC_MALFORMED_XML
public static final int RC_INVALID_XML
public static final int RC_INVALID_XS
public static final int RC_INVALID_CRED
public static final int RC_SIG
public static final int RC_UNKNOWN
| Constructor Detail |
|---|
public XmlSecTool()
| Method Detail |
|---|
public static void main(String[] args)
args - protected static Document parseXML(XmlSecToolCommandLineArguments cli)
cli - command line arguments
protected static InputStream getXmlInputStreamFromFile(XmlSecToolCommandLineArguments cli)
cli - command line arguments
protected static InputStream getXmlInputStreamFromUrl(XmlSecToolCommandLineArguments cli)
cli - command line arguments
protected static DocumentBuilder getParser(XmlSecToolCommandLineArguments cli)
cli - command line arguments
protected static void schemaValidate(XmlSecToolCommandLineArguments cli,
Document xml)
cli - command line argumentsxml - document to validate
protected static void sign(XmlSecToolCommandLineArguments cli,
Document xml)
cli - command line argumentsxml - document to be signed
protected static void populateKeyInfo(Document doc,
org.apache.xml.security.keys.KeyInfo keyInfo,
org.opensaml.xml.security.x509.BasicX509Credential credential)
doc - XML document in which the elements will be rootedkeyInfo - the KeyInfo to be populatedcredential - the credential
protected static String getSignatureReferenceUri(XmlSecToolCommandLineArguments cli,
Element rootElement)
cli - command line argumentsrootElement - document root element
protected static void addSignatureELement(XmlSecToolCommandLineArguments cli,
Element root,
Element signature)
cli - command line argumentroot - element to which the signature will be added as a childsignature - signature to be added to the document's root element
protected static void verifySignature(XmlSecToolCommandLineArguments cli,
Document xmlDocument)
cli - command line argumentxmlDocument - document whose signature will be validated
protected static void validateSignatureReference(Document xmlDocument,
org.apache.xml.security.signature.XMLSignature signature)
xmlDocument - current XML documentsignature - signature to be verified
protected static void validateSignatureReferenceUri(Document xmlDocument,
org.apache.xml.security.signature.XMLSignature signature,
org.apache.xml.security.signature.Reference reference)
IdResolver is the same as the
element resolved by the DOM layer.
xmlDocument - the signed documentsignature - the signature to be validatedreference - the reference to be validatedprotected static void validateSignatureTransforms(org.apache.xml.security.signature.Reference reference)
reference - the Signature reference containing the transforms to evaluateprotected static Element getSignatureElement(Document xmlDoc)
xmlDoc - document from which to pull the signature
protected static org.opensaml.xml.security.x509.BasicX509Credential getCredential(XmlSecToolCommandLineArguments cli)
cli - command line arguments
protected static Collection<X509CRL> getCRLs(XmlSecToolCommandLineArguments cli)
cli - command line arguments
protected static void writeDocument(XmlSecToolCommandLineArguments cli,
Node xml)
cli - command line argumentsxml - the XML element to outputprotected static void initLogging(XmlSecToolCommandLineArguments cli)
cli - command line arguments
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||