org.jboss.identity.federation.api.util
Class XMLSignatureUtil

java.lang.Object
  extended by org.jboss.identity.federation.api.util.XMLSignatureUtil

public class XMLSignatureUtil
extends java.lang.Object

Utility for XML Signature

Since:
Dec 15, 2008
Author:
Anil.Saldhana@redhat.com

Constructor Summary
XMLSignatureUtil()
           
 
Method Summary
static void marshall(org.w3c.dom.Document signedDocument, java.io.OutputStream os)
          Marshall the signed document to an output stream
static void marshall(SignatureType signature, java.io.OutputStream os)
          Marshall a SignatureType to output stream
static org.w3c.dom.Document sign(AuthnRequestType request, java.security.PrivateKey signingKey, javax.security.cert.X509Certificate certificate, java.lang.String digestMethod, java.lang.String signatureMethod)
          Sign an AuthnRequestType
static org.w3c.dom.Document sign(RequestAbstractType request, java.security.KeyPair keypair, java.lang.String digestMethod, java.lang.String signatureMethod)
          Sign an RequestType
static boolean validate(org.w3c.dom.Document signedDoc, java.security.Key publicKey)
          Validate a signed document with the given public key
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLSignatureUtil

public XMLSignatureUtil()
Method Detail

sign

public static org.w3c.dom.Document sign(AuthnRequestType request,
                                        java.security.PrivateKey signingKey,
                                        javax.security.cert.X509Certificate certificate,
                                        java.lang.String digestMethod,
                                        java.lang.String signatureMethod)
                                 throws java.lang.Exception
Sign an AuthnRequestType

Parameters:
request -
signingKey - Private Key for signing
cert - X509Certificate public key certificate (may be null)
digestMethod - (Example: DigestMethod.SHA1)
signatureMethod - (Example: SignatureMethod.DSA_SHA1)
Returns:
Throws:
java.lang.Exception

sign

public static org.w3c.dom.Document sign(RequestAbstractType request,
                                        java.security.KeyPair keypair,
                                        java.lang.String digestMethod,
                                        java.lang.String signatureMethod)
                                 throws java.lang.Exception
Sign an RequestType

Parameters:
request -
keypair - Key Pair
digestMethod - (Example: DigestMethod.SHA1)
signatureMethod - (Example: SignatureMethod.DSA_SHA1)
Returns:
Throws:
java.lang.Exception

validate

public static boolean validate(org.w3c.dom.Document signedDoc,
                               java.security.Key publicKey)
                        throws java.lang.Exception
Validate a signed document with the given public key

Parameters:
signedDoc -
publicKey -
Returns:
Throws:
java.lang.Exception

marshall

public static void marshall(SignatureType signature,
                            java.io.OutputStream os)
                     throws java.lang.Exception
Marshall a SignatureType to output stream

Parameters:
signature -
os -
Throws:
java.lang.Exception

marshall

public static void marshall(org.w3c.dom.Document signedDocument,
                            java.io.OutputStream os)
                     throws java.lang.Exception
Marshall the signed document to an output stream

Parameters:
signedDocument -
os -
Throws:
java.lang.Exception


Copyright © 2009 JBoss Inc.. All Rights Reserved.