es.caib.signatura.api
Interface Signature


public interface Signature

Interface to acces to the digital signature of a document. It provides the necessary methods to get the digital signature and information associated to the certificate used to sign the document.

Author:
Jesús Reyes (3dígits)
See Also:
Signature

Method Summary
 java.security.cert.X509Certificate getCert()
          Returns the X509 certificate used to sign.
 java.lang.String getCertCaName()
          Gets the name of the certification authority of the certificate used to sign.
 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()
          Gets the subject's Common Name of the certificate used to sign.
 java.lang.String getContentType()
          Returns the content type of the certificate.
 java.util.Date getDate()
          Gets the date of the signature timestamp.
 ParsedCertificate getParsedCertificate()
          Devuelve el Seycon Principal a partir del certificado con el que se ha firmado.
 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.
 

Method Detail

getCertCaName

java.lang.String getCertCaName()
Gets the name of the certification authority of the certificate used to sign.

Returns:
the name of the certification authority.

getCertSubjectCommonName

java.lang.String getCertSubjectCommonName()
Gets the subject's Common Name of the certificate used to sign.

Returns:
the subject common name.

getCertSubjectAlternativeNames

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, ...

Returns:
a string containing the subject's alternate name of the certificate.

getDate

java.util.Date getDate()
                       throws SignatureTimestampException
Gets the date of the signature timestamp.

Returns:
the date of the signature timestamp or null if the signature doesn't include timestamp.
Throws:
SignatureTimestampException

verify

boolean verify()
               throws SignatureVerifyException
Determinate the certificate validity of the signature.

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

getPkcs7

byte[] getPkcs7()
Returns the signature in PKCS#7 format.

Returns:
a byte array containing the signature in PKCS#7 format.

getContentType

java.lang.String getContentType()
Returns the content type of the certificate.

Returns:
the content type of the certificate.

getCert

java.security.cert.X509Certificate getCert()
Returns the X509 certificate used to sign.

Returns:
the X509Certificate used to sign.

getCertificateChain

java.security.cert.X509Certificate[] getCertificateChain()
                                                         throws java.lang.Exception
Returns the certificate chain.

Returns:
the certificate chain.
Throws:
java.lang.Exception

getParsedCertificate

ParsedCertificate getParsedCertificate()
Devuelve el Seycon Principal a partir del certificado con el que se ha firmado.

Returns:
SeyconPrincipal

verify

boolean verify(java.io.InputStream contentStream)
               throws SignatureProviderException,
                      java.io.IOException,
                      SignatureVerifyException
Verifies the digital signature of a document. The verification process is independent of signature timestamp.

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.

verifyAPosterioriTimestamp

boolean verifyAPosterioriTimestamp(java.io.InputStream contentStream)
                                   throws SignatureProviderException,
                                          java.io.IOException,
                                          SignatureVerifyException
Verifies the digital signature of a document. If the digital signature requires a timestamp and don't have it then a timestamp is added. Si la firma requiere sello de tiempo y no dispone de él, se intenta añadir el sello de tiempo

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 © 2009 Direcció General de Tecnologia i Comunicacions. Govern de les Illes Balears. All Rights Reserved.