es.caib.signatura.provider.tradise
Class TradiseSignature

java.lang.Object
  extended by es.caib.signatura.provider.tradise.TradiseSignature
All Implemented Interfaces:
Signature, java.io.Serializable
Direct Known Subclasses:
TradiseSignatureRaw, TradiseSignatureTest

public class TradiseSignature
extends java.lang.Object
implements Signature, java.io.Serializable

Implementación de la interfaz SignatureData para usar con la entidad certificadora Tradisea

Version:
0.98
Author:
3digits
See Also:
Signer, Signature, Serialized Form

Field Summary
protected  byte[] signatureBytes
           
 
Constructor Summary
TradiseSignature(byte[] pkcs7, java.lang.String contentType)
          Crea un nuevo objeto a partir de los atributos de la clase.
TradiseSignature(SignatureProviderInterface impl)
           
 
Method Summary
 java.security.cert.X509Certificate getCert()
          Returns the X509 certificate used to sign.
 java.lang.String getCertCaName()
          Obtiene el nombre de la entidad certificadora usada en la firma
 java.security.cert.X509Certificate[] getCertificateChain()
          Returns the certificate chain.
 java.lang.String getCertSubjectAlternativeNames()
          Gets the concatenation of the subject's alternate name of the certificate used to sign as follows: name0 = value, name1 = value, ...
 java.lang.String getCertSubjectCommonName()
          Obtiene el nombre del certificado usado en la firma
protected  java.lang.String getClassLoaderName()
           
 java.lang.String getContentType()
          Returns the content type of the signature.
 java.util.Date getDate()
          Gets the date of the signature timestamp.
protected  java.lang.String getImplClassName()
           
 ParsedCertificate getParsedCertificate()
          Gets a ParsedCertificate object with the subject's credentials.
 byte[] getPkcs7()
          Returns the signature in PKCS#7 format.
 boolean verify()
          Determinate the certificate validity of the signature.
 boolean verify(java.io.InputStream contentStream)
          Verifies the digital signature of a document.
 boolean verifyAPosterioriTimestamp(java.io.InputStream contentStream)
          Verifies the digital signature of a document.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

signatureBytes

protected byte[] signatureBytes
Constructor Detail

TradiseSignature

public TradiseSignature(byte[] pkcs7,
                        java.lang.String contentType)
                 throws SignatureDataException
Crea un nuevo objeto a partir de los atributos de la clase. Es el constructor que debe usar cada implementación de la interfaz Signature para crear una firma. Se extrae el certificado de la firma y se guarda en la propiedad transient certificate para usarla en los métodos que dan información concreta del certificado

Parameters:
signatureBytes - array de bytes con la firma digital generada por la api del proveedor de firma electrónica
Throws:
SignatureDataException

TradiseSignature

public TradiseSignature(SignatureProviderInterface impl)
Method Detail

getClassLoaderName

protected java.lang.String getClassLoaderName()

getImplClassName

protected java.lang.String getImplClassName()

getCertCaName

public java.lang.String getCertCaName()
Obtiene el nombre de la entidad certificadora usada en la firma

Specified by:
getCertCaName in interface Signature
Returns:
nombre de la entidad certificadora

getCertSubjectCommonName

public java.lang.String getCertSubjectCommonName()
Obtiene el nombre del certificado usado en la firma

Specified by:
getCertSubjectCommonName in interface Signature
Returns:
nombre del certificado (CommonName)

getCertSubjectAlternativeNames

public java.lang.String getCertSubjectAlternativeNames()
Description copied from interface: Signature
Gets the concatenation of the subject's alternate name of the certificate used to sign as follows: name0 = value, name1 = value, ...

Specified by:
getCertSubjectAlternativeNames in interface Signature
Returns:
a string containing the subject's alternate name of the certificate.

getPkcs7

public byte[] getPkcs7()
Description copied from interface: Signature
Returns the signature in PKCS#7 format.

Specified by:
getPkcs7 in interface Signature
Returns:
a byte array containing the signature in PKCS#7 format.

getDate

public java.util.Date getDate()
                       throws SignatureTimestampException
Description copied from interface: Signature
Gets the date of the signature timestamp.

Specified by:
getDate in interface Signature
Returns:
the date of the signature timestamp or null if the signature doesn't include timestamp.
Throws:
SignatureTimestampException

verify

public boolean verify()
               throws SignatureVerifyException
Description copied from interface: Signature
Determinate the certificate validity of the signature.

Specified by:
verify in interface Signature
Returns:
true if the certificate is valid; false otherwise.
Throws:
SignatureVerifyException
See Also:
Signer.verify(java.io.InputStream, es.caib.signatura.api.Signature)

getContentType

public java.lang.String getContentType()
Description copied from interface: Signature
Returns the content type of the signature.

Specified by:
getContentType in interface Signature
Returns:
the content type of the signature.

getCert

public java.security.cert.X509Certificate getCert()
Description copied from interface: Signature
Returns the X509 certificate used to sign.

Specified by:
getCert in interface Signature
Returns:
the X509Certificate used to sign.

getCertificateChain

public java.security.cert.X509Certificate[] getCertificateChain()
                                                         throws java.lang.Exception
Description copied from interface: Signature
Returns the certificate chain.

Specified by:
getCertificateChain in interface Signature
Returns:
the certificate chain.
Throws:
java.lang.Exception

getParsedCertificate

public ParsedCertificate getParsedCertificate()
Description copied from interface: Signature
Gets a ParsedCertificate object with the subject's credentials.

Specified by:
getParsedCertificate in interface Signature
Returns:
a ParsedCertificate object with the subject's credentials.

verifyAPosterioriTimestamp

public boolean verifyAPosterioriTimestamp(java.io.InputStream contentStream)
                                   throws SignatureProviderException,
                                          java.io.IOException,
                                          SignatureVerifyException
Description copied from interface: Signature
Verifies the digital signature of a document. If the digital signature requires a timestamp and don't have it then a timestamp is added (if possible).

Specified by:
verifyAPosterioriTimestamp in interface Signature
Parameters:
contentStream - byte stream of the document.
Returns:
true if the verification process is correct; false otherwise.
Throws:
SignatureProviderException - If the API provider cannot be accessed.
java.io.IOException - If the document or the timestamp server is not available.
SignatureVerifyException - If failed the verification process.

verify

public boolean verify(java.io.InputStream contentStream)
               throws SignatureProviderException,
                      java.io.IOException,
                      SignatureVerifyException
Description copied from interface: Signature
Verifies the digital signature of a document. The verification process is independent of signature timestamp.

Specified by:
verify in interface Signature
Parameters:
contentStream - byte stream of the document.
Returns:
true if the verification process is correct; false otherwise.
Throws:
SignatureProviderException - If the API provider cannot be accessed.
java.io.IOException - If the document or the timestamp server is not available.
SignatureVerifyException - If failed the verification process.


Copyright © 2011 Direcció General de Tecnologia i Comunicacions. Govern de les Illes Balears. All Rights Reserved.