org.jboss.identity.federation.core.saml.v2.util
Class SignatureUtil

java.lang.Object
  extended by org.jboss.identity.federation.core.saml.v2.util.SignatureUtil

public class SignatureUtil
extends java.lang.Object

Signature utility for signing content

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

Constructor Summary
SignatureUtil()
           
 
Method Summary
static java.lang.String getXMLSignatureAlgorithmURI(java.lang.String algo)
          Get the XML Signature URI for the algo (RSA, DSA)
static byte[] sign(java.lang.String stringToBeSigned, java.security.PrivateKey signingKey)
          Sign a string using the private key
static boolean validate(byte[] signedContent, byte[] signatureValue, java.security.PublicKey validatingKey)
          Validate the signed content with the signature value
static boolean validate(byte[] signedContent, byte[] signatureValue, java.lang.String signatureAlgorithm, java.security.cert.X509Certificate validatingCert)
          Validate the signature using a x509 certificate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SignatureUtil

public SignatureUtil()
Method Detail

getXMLSignatureAlgorithmURI

public static java.lang.String getXMLSignatureAlgorithmURI(java.lang.String algo)
Get the XML Signature URI for the algo (RSA, DSA)

Parameters:
algo -
Returns:

sign

public static byte[] sign(java.lang.String stringToBeSigned,
                          java.security.PrivateKey signingKey)
                   throws java.lang.Exception
Sign a string using the private key

Parameters:
stringToBeSigned -
signingKey -
Returns:
Throws:
java.lang.Exception

validate

public static boolean validate(byte[] signedContent,
                               byte[] signatureValue,
                               java.security.PublicKey validatingKey)
                        throws java.lang.Exception
Validate the signed content with the signature value

Parameters:
signedContent -
signatureValue -
validatingKey -
Returns:
Throws:
java.lang.Exception

validate

public static boolean validate(byte[] signedContent,
                               byte[] signatureValue,
                               java.lang.String signatureAlgorithm,
                               java.security.cert.X509Certificate validatingCert)
                        throws java.lang.Exception
Validate the signature using a x509 certificate

Parameters:
signedContent -
signatureValue -
signatureAlgorithm -
validatingCert -
Returns:
Throws:
java.lang.Exception


Copyright © 2009 JBoss Inc.. All Rights Reserved.