|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcc.saml.SAMLSignature
public class SAMLSignature
Utility for signing SAML DOM objects (assertions, requests, and responses) and for validating and checking signatures on SAML DOM objects. Unlike the rest of this package, this utility does not rely on OpenSAML; it operates directly on DOM trees. (There is an import of OpenSAML's XMLObject type, but that's just for our main method, which in turn is just for testing purposes.)
| Nested Class Summary | |
|---|---|
private static class |
SAMLSignature.KeyValueKeySelector
KeySelector that can handle KeyValue and X509Data info. |
private static class |
SAMLSignature.SimpleKeySelectorResult
Data structure returned by the key selector to the validation context. |
| Field Summary | |
|---|---|
private javax.xml.crypto.dsig.XMLSignatureFactory |
factory
|
private javax.xml.crypto.dsig.keyinfo.KeyInfo |
keyInfo
|
private java.security.KeyPair |
keyPair
|
private java.security.KeyStore |
keyStore
|
| Constructor Summary | |
|---|---|
SAMLSignature()
Loads a keystore and builds a stock key-info structure for use by base classes. |
|
| Method Summary | |
|---|---|
(package private) static boolean |
algEquals(java.lang.String algURI,
java.lang.String algName)
Test that a formal URI expresses the same algorithm as a conventional short name such as "DSA" or "RSA". |
static void |
main(java.lang.String[] args)
Parse the command line for a filename to read, and optionally a filename to write (absent which the application will write to the console). |
void |
signSAMLObject(org.w3c.dom.Element target)
Adds an enveloped signature to the given element. |
boolean |
verifySAMLSignature(org.w3c.dom.Element target)
Seeks out the signature element in the given tree, and validates it. |
void |
writeFiles(org.w3c.dom.Document doc,
java.lang.String baseFilename)
Helper method to write two output files from a given DOM tree: one is the raw output and one is pretty-printed and given the suffix "_pretty" before the ".xml" extension. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private javax.xml.crypto.dsig.XMLSignatureFactory factory
private java.security.KeyStore keyStore
private java.security.KeyPair keyPair
private javax.xml.crypto.dsig.keyinfo.KeyInfo keyInfo
| Constructor Detail |
|---|
public SAMLSignature()
| Method Detail |
|---|
public static void main(java.lang.String[] args)
throws java.lang.Exception
pretty printer.
Or, validates the signature found in the given file.
java.lang.Exception
public void signSAMLObject(org.w3c.dom.Element target)
throws java.security.GeneralSecurityException,
javax.xml.crypto.dsig.XMLSignatureException,
javax.xml.crypto.MarshalException
java.security.GeneralSecurityException
javax.xml.crypto.dsig.XMLSignatureException
javax.xml.crypto.MarshalException
public boolean verifySAMLSignature(org.w3c.dom.Element target)
throws java.lang.Exception
java.lang.Exception
static boolean algEquals(java.lang.String algURI,
java.lang.String algName)
public void writeFiles(org.w3c.dom.Document doc,
java.lang.String baseFilename)
throws java.io.IOException
java.io.IOException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||