org.nhindirect.stagent
Class DefaultMessageSignatureImpl

java.lang.Object
  extended by org.nhindirect.stagent.DefaultMessageSignatureImpl
All Implemented Interfaces:
MessageSignature

public class DefaultMessageSignatureImpl
extends java.lang.Object
implements MessageSignature

Contains information specific to a discrete signer of a message. Includes the singer information and the certificate used to sign the message (optimally extracted from the signature). This is a subset of the CMS signed data.

Author:
Greg Meyer, Umesh Madan

Constructor Summary
DefaultMessageSignatureImpl(org.bouncycastle.cms.SignerInformation signer, boolean useOrgCert, java.security.cert.X509Certificate cert)
          Constructs a message signature from the singer info and the certificate used to sign the message.
 
Method Summary
 boolean checkSignature()
          Verifies if the signature is valid using the signature certificate.
 boolean checkThumbprint(NHINDAddress messageSender)
          Validates if the senders certificate matches the signature certificate using certificate thumb printing.
 org.bouncycastle.cms.SignerInformation getSigner()
          Gets the signer information for this specific signature.
 java.security.cert.X509Certificate getSignerCert()
          Get the certificate used to sign the message for this specific signer.
 boolean isSignatureValid()
          Indicate if the signature has been validated for authenticity and consistency.
 boolean isThumbprintVerified()
          Indicates if the signature certificate has been verified against a senders certificate.
 boolean isUseOrgCertificate()
          Indicate if the certificate used to sign the message for this signer is an org level or individual level cert.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultMessageSignatureImpl

public DefaultMessageSignatureImpl(org.bouncycastle.cms.SignerInformation signer,
                                   boolean useOrgCert,
                                   java.security.cert.X509Certificate cert)
Constructs a message signature from the singer info and the certificate used to sign the message.

Parameters:
signer - Information about the individual signature such as the signers id and algorithms used to sign.
useOrgCert - Indicates if the certificate used is a org level or individual level certificate
cert - The public certificate used to sign the message for this signer.
Method Detail

getSignerCert

public java.security.cert.X509Certificate getSignerCert()
Get the certificate used to sign the message for this specific signer.

Returns:
The certificate used to sign the message.

isSignatureValid

public boolean isSignatureValid()
Indicate if the signature has been validated for authenticity and consistency.

Returns:
True if the signature is valid. False otherwise.

getSigner

public org.bouncycastle.cms.SignerInformation getSigner()
Gets the signer information for this specific signature.

Returns:
The signer information for this specific signature.

isUseOrgCertificate

public boolean isUseOrgCertificate()
Indicate if the certificate used to sign the message for this signer is an org level or individual level cert.

Returns:
True if the certificate is an org level cert. False otherwise.

isThumbprintVerified

public boolean isThumbprintVerified()
Indicates if the signature certificate has been verified against a senders certificate.

Returns:
True if the thumb print has been verified. False otherwise. checkThumbprint should be called first before calling this method.

checkSignature

public boolean checkSignature()
Verifies if the signature is valid using the signature certificate.

Specified by:
checkSignature in interface MessageSignature
Returns:
True if the signature is valid. False otherwise.

checkThumbprint

public boolean checkThumbprint(NHINDAddress messageSender)
Validates if the senders certificate matches the signature certificate using certificate thumb printing.

Specified by:
checkThumbprint in interface MessageSignature
Parameters:
messageSender - The senders address. The address should contain the senders public certificate.
Returns:
True if the thumb print of the signature matches the senders certificate thumb print. False otherwise.


Copyright © 2010-2011 HNIN Direct. All Rights Reserved.