|
|||||||||
| 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 | |
|---|---|
private static Logger |
log
Class logger. |
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 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_NOHOME
Return code indicating that the JAVA_HOME variable is not set within the shell script, 8 . |
static int |
RC_NOJAVA
Return code indicating that the "java" command is not executable within the shell script, 9 . |
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 Reference |
extractReference(XMLSignature signature)
Extract the reference within the provided XML signature while ensuring that there is only one such reference. |
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 void |
markIdAttribute(Element docElement,
Reference reference)
Reconcile the given reference with the document element, by making sure that the appropriate attribute is marked as an ID attribute. |
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,
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 document against the schema source indicated by the CLI arguments. |
protected static void |
sign(XmlSecToolCommandLineArguments cli,
Document xml)
Signs and outputs the signed SAML document. |
protected static void |
validateSignatureReference(Document xmlDocument,
Reference ref)
Validates the reference within the XML signature by performing the following checks. |
protected static void |
validateSignatureReferenceUri(Document xmlDocument,
Reference reference)
Validates that the element resolved by the signature validation layer is the same as the element resolved by the DOM layer. |
protected static void |
validateSignatureTransforms(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_NOHOME
public static final int RC_NOJAVA
public static final int RC_UNKNOWN
private static Logger log
| 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,
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 markIdAttribute(Element docElement,
Reference reference)
docElement - document element whose appropriate attribute should be markedreference - reference which references the document element
protected static void verifySignature(XmlSecToolCommandLineArguments cli,
Document xmlDocument)
cli - command line argumentxmlDocument - document whose signature will be validatedprotected static Reference extractReference(XMLSignature signature)
signature - signature to extract the reference from
protected static void validateSignatureReference(Document xmlDocument,
Reference ref)
xmlDocument - current XML documentref - reference to be verified
protected static void validateSignatureReferenceUri(Document xmlDocument,
Reference reference)
xmlDocument - the signed documentreference - the reference to be validatedprotected static void validateSignatureTransforms(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 | ||||||||