au.gov.nehta.vendorlibrary.common.security
Class SignedContainerProfileUtil

java.lang.Object
  extended by au.gov.nehta.vendorlibrary.common.security.SignedContainerProfileUtil

public final class SignedContainerProfileUtil
extends java.lang.Object


Field Summary
static au.gov.nehta.xsp.CertificateValidator NULL_CERTIFICATE_VALIDATOR
          CertificateVerifier instance to sign/verify signed data.
static au.gov.nehta.xsp.CertificateVerifier NULL_CERTIFICATE_VERIFIER
          CertificateVerifier instance to sign/verify signed data.
 
Method Summary
static org.w3c.dom.Document getDataFromSignedPayload(org.w3c.dom.Document signedDocument)
          Returns the extracted data/payload form the provided signedPayload Note:
This uses the default private key from the keystore.
static java.util.List<byte[]> getDigestValue(org.w3c.dom.Document containerDoc)
          Get the 'DigestValue' of each signature in a SignedPayload XML document.
static org.w3c.dom.Document getSignedPayload(java.lang.String sensitivePayload, java.util.List<javax.security.auth.x500.X500PrivateCredential> certificateKeyPairs)
           
static org.w3c.dom.Document getSignedPayload(java.lang.String sensitivePayload, java.security.cert.X509Certificate siginingCert, java.security.PrivateKey siginingPrivateKey)
           
static java.util.List<java.security.cert.X509Certificate> getSigningCertificates(org.w3c.dom.Document containerDoc)
          Get the 'DigestValue' of each signature in a SignedPayload XML document.
static boolean verifySignature(org.w3c.dom.Document signedDocument)
          Verifies the signature of a signed document.
static boolean verifySignature(org.w3c.dom.Document signedDocument, au.gov.nehta.xsp.CertificateValidator certificateValidator)
          Verifies the signature of a signed document.
static boolean verifySignature(org.w3c.dom.Document signedDocument, au.gov.nehta.xsp.CertificateVerifier certificateVerifier)
          Deprecated. use the verifySignature() that takes a CertificateValidator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NULL_CERTIFICATE_VERIFIER

public static final au.gov.nehta.xsp.CertificateVerifier NULL_CERTIFICATE_VERIFIER
CertificateVerifier instance to sign/verify signed data. Validation ignored with an assumption that the certificates under test are valid. MUST INCLUDE VALIDATION CODE FOR PRODUCTION PURPOSE


NULL_CERTIFICATE_VALIDATOR

public static final au.gov.nehta.xsp.CertificateValidator NULL_CERTIFICATE_VALIDATOR
CertificateVerifier instance to sign/verify signed data. Validation ignored with an assumption that the certificates under test are valid. MUST INCLUDE VALIDATION CODE FOR PRODUCTION PURPOSE

Method Detail

getSignedPayload

public static org.w3c.dom.Document getSignedPayload(java.lang.String sensitivePayload,
                                                    java.security.cert.X509Certificate siginingCert,
                                                    java.security.PrivateKey siginingPrivateKey)
                                             throws au.gov.nehta.xsp.XspException
Throws:
au.gov.nehta.xsp.XspException

getSignedPayload

public static org.w3c.dom.Document getSignedPayload(java.lang.String sensitivePayload,
                                                    java.util.List<javax.security.auth.x500.X500PrivateCredential> certificateKeyPairs)
                                             throws au.gov.nehta.xsp.XspException
Throws:
au.gov.nehta.xsp.XspException

getDigestValue

public static java.util.List<byte[]> getDigestValue(org.w3c.dom.Document containerDoc)
                                             throws au.gov.nehta.xsp.XspException
Get the 'DigestValue' of each signature in a SignedPayload XML document.

Parameters:
containerDoc - A DOM Document structured according to the signedPayload element declared in the XML Secured Payload Schema. Cannot be null.
Returns:
The 'DigestValue' of each signature in a SignedPayload XML document. (in the order that the signature appears in the container document)
Throws:
au.gov.nehta.xsp.XspException - If there are any other errors extracting the digest values.

getSigningCertificates

public static java.util.List<java.security.cert.X509Certificate> getSigningCertificates(org.w3c.dom.Document containerDoc)
                                                                                 throws au.gov.nehta.xsp.XspException
Get the 'DigestValue' of each signature in a SignedPayload XML document.

Parameters:
containerDoc - A DOM Document structured according to the signedPayload element declared in the XML Secured Payload Schema. Cannot be null.
Returns:
The 'DigestValue' of each signature in a SignedPayload XML document. (in the order that the signature appears in the container document)
Throws:
au.gov.nehta.xsp.XspException - If there are any other errors extracting the digest values.

getDataFromSignedPayload

public static org.w3c.dom.Document getDataFromSignedPayload(org.w3c.dom.Document signedDocument)
                                                     throws au.gov.nehta.xsp.XspException
Returns the extracted data/payload form the provided signedPayload Note:
This uses the default private key from the keystore.

Parameters:
signedDocument -
Returns:
the payload as Document
Throws:
au.gov.nehta.xsp.XspException

verifySignature

public static boolean verifySignature(org.w3c.dom.Document signedDocument,
                                      au.gov.nehta.xsp.CertificateVerifier certificateVerifier)
                               throws au.gov.nehta.xsp.SignatureValidationException
Deprecated. use the verifySignature() that takes a CertificateValidator

Verifies the signature of a signed document.

Note:
This uses the default private key from the keystore.

Parameters:
signedDocument - the signed document
certificateVerifier - the certificate verifier implementation to be used to verify the certificate used to verify the signature.
Returns:
the payload as Document
Throws:
au.gov.nehta.xsp.SignatureValidationException

verifySignature

public static boolean verifySignature(org.w3c.dom.Document signedDocument,
                                      au.gov.nehta.xsp.CertificateValidator certificateValidator)
                               throws au.gov.nehta.xsp.SignatureValidationException
Verifies the signature of a signed document.

Note:
This uses the default private key from the keystore.

Parameters:
signedDocument - the signed document
certificateVerifier - the certificate verifier implementation to be used to verify the certificate used to verify the signature.
Returns:
the payload as Document
Throws:
au.gov.nehta.xsp.SignatureValidationException

verifySignature

public static boolean verifySignature(org.w3c.dom.Document signedDocument)
                               throws au.gov.nehta.xsp.SignatureValidationException
Verifies the signature of a signed document. Note:
This uses the default private key from the keystore. This uses certificate verifier which does NOT perform any verification.

Parameters:
signedDocument - the signed document
Returns:
the payload as Document
Throws:
au.gov.nehta.xsp.SignatureValidationException