|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface Signer
Interface to abstract signing and verifying implementations of diferent certificate entities. Generated
signatures are detached (doesn't include signed data) and can have timestamp.
Signatures are encapsulated into Signature objects.
Signature| Field Summary | |
|---|---|
static int |
PDF_SIGN_DEFAULT_SIGNATURE_APPERANCE
Indica que se añadirá una estampa por defecto de adobe, en vez del código de puntos PDF417. |
static int |
PDF_SIGN_PAGE_LAST
Indica que sólo se añadirá en la última página |
static int |
PDF_SIGN_PDF417_SIGNATURE_APPERANCE
|
static int |
PDF_SIGN_POSITION_BOTTOM
Indicates that the signature will be added in the bottom part of the PDF document. |
static int |
PDF_SIGN_POSITION_LEFT
Indicates that the signature will be added in the left part of the PDF document. |
static int |
PDF_SIGN_POSITION_NONE
Neither code bars nor signer information will be added to the PDF document. |
static int |
PDF_SIGN_POSITION_RIGHT
Indicates that the signature will be added int the right part of the PDF document. |
static int |
PDF_SIGN_POSITION_TOP
Indicates that the signature will be added in the upper part of the PDF document. |
| Method Summary | |
|---|---|
void |
certifyDigitalCopy(java.io.InputStream contentStream,
java.io.OutputStream signedStream,
java.lang.String certificateName,
java.lang.String password,
java.lang.String contentType,
java.lang.String url,
java.lang.String localidad,
float x,
float y,
float rotation)
Firma digitalmente de un documento PDF pasado como InputStream y devuelve el mismo PDF firmado
y modificado de forma que, en uno de los bordes del documento que se le indique, aparezca el firmante que
compulsa la copia, la url desde la que se puede consultar el PDF y una matriz de puntos en formato PDF417 que
continene esa misma URL. |
void |
generateSMIME(java.io.InputStream document,
Signature signature,
java.io.OutputStream smime)
Generates SMIME document from the document and its digital signature. |
void |
generateSMIMEParalell(java.io.InputStream document,
Signature[] signatures,
java.io.OutputStream smime)
Obtiene el documento SMIME a partir del documento original y el conjunto de firmas digitales obtenidas de firmas el documento. |
java.lang.String |
getAPIVersion()
Gets the API version number. |
java.lang.String[] |
getCertList(java.lang.String contentType)
Gets the available certificate names list to the API: hard disk, USB devices, cryptographic cards, etc. |
java.util.Date |
getCurrentDate(java.lang.String certificateName,
java.lang.String password,
java.lang.String contentType)
Obtiene la hora oficial que tendría un sello de tiempo generado en ese mismo instante |
SMIMEParser |
getSMIMEParser(java.io.InputStream smime)
Returns an SMIMEParser object to access to the SMIME document information. |
ParsedCertificate |
parseCertificate(java.security.cert.X509Certificate certificateChain)
Returns basic certificate information. |
Signature |
sign(java.io.InputStream contentStream,
java.lang.String certificateName,
java.lang.String password,
java.lang.String contentType)
Gets the digital signature of an input data stream and encapusulates it into a Signature object
without timestamp. |
Signature |
sign(java.lang.String fileName,
java.lang.String certificateName,
java.lang.String password,
java.lang.String contentType)
Gets the digital signature of a hard disk document and encapsulates it into a signature object without timestamp. |
Signature |
sign(java.net.URL url,
java.lang.String certificateName,
java.lang.String password,
java.lang.String contentType)
Signs a document obtained from an URL. |
void |
signPDF(java.io.InputStream contentStream,
java.io.OutputStream signedStream,
java.lang.String certificateName,
java.lang.String password,
java.lang.String contentType,
java.lang.String url,
int position)
Signs a document obtained from an URL. |
void |
signPDF(java.io.InputStream contentStream,
java.io.OutputStream signedStream,
java.lang.String certificateName,
java.lang.String password,
java.lang.String contentType,
java.lang.String url,
int position,
boolean allowMultipleSignature)
Signs a PDF document. |
void |
signPDF(java.io.InputStream pdfInputStream,
java.io.OutputStream signedStream,
java.lang.String certificateName,
java.lang.String password,
java.lang.String contentType,
java.lang.String textoAdicional,
int stampOptions,
float top,
float left,
float height,
float width,
float rotation,
boolean allowMultipleSignature)
Firma digitalmente de un documento PDF pasado como InputStream y devuelve el mismo PDF firmado
y modificado. |
java.io.OutputStream |
signPDF(java.io.InputStream contentStream,
java.lang.String certificateName,
java.lang.String password,
java.lang.String contentType,
java.lang.String url,
int position)
Deprecated. |
java.io.OutputStream |
signPDF(java.io.InputStream contentStream,
java.lang.String certificateName,
java.lang.String password,
java.lang.String contentType,
java.lang.String url,
int position,
boolean allowMultipleSignature)
Deprecated. |
boolean |
verify(java.io.InputStream contentStream,
Signature signatureData)
Verifies the digital signature of a document obtained from an URL. |
boolean |
verify(java.lang.String fileName,
Signature signatureData)
Verifies the digital signature of a document contained into the hard disk. |
boolean |
verify(java.net.URL url,
Signature signatureData)
Verifies the digital signature of a document obtained from an URL. |
boolean |
verifyAPosterioriTimeStamp(java.io.InputStream contentStream,
Signature signatureData)
Verifies the signature of an input data stream. |
boolean |
verifyAPosterioriTimeStamp(java.lang.String fileName,
Signature signatureData)
Verifies the digital signature of an input data stream. |
boolean |
verifyAPosterioriTimeStamp(java.net.URL url,
Signature signatureData)
Verifies the digital signature of a document obtained from an URL. |
| Field Detail |
|---|
static final int PDF_SIGN_POSITION_TOP
static final int PDF_SIGN_POSITION_BOTTOM
static final int PDF_SIGN_POSITION_LEFT
static final int PDF_SIGN_POSITION_RIGHT
static final int PDF_SIGN_POSITION_NONE
static final int PDF_SIGN_PAGE_LAST
static final int PDF_SIGN_DEFAULT_SIGNATURE_APPERANCE
static final int PDF_SIGN_PDF417_SIGNATURE_APPERANCE
| Method Detail |
|---|
java.lang.String[] getCertList(java.lang.String contentType)
throws SignatureCertNotFoundException,
SignaturePrivKeyException
SignatureCertNotFoundException - if no available certificates.
SignaturePrivKeyException - if unable to access to private keys.
Signature sign(java.lang.String fileName,
java.lang.String certificateName,
java.lang.String password,
java.lang.String contentType)
throws java.io.IOException,
SignatureException
fileName - path of the document.certificateName - name of the certificate used to sign the document.password - private key password of the certificate.contentType - MIME type of the document to sign.
Signature the document signature.
java.io.FileNotFoundException - if unable to find the document.
java.io.IOException - if I/O errors occurs.
SignatureProviderException - if unable to access to the signature API needed provider.
SignatureSignException - if an error occurs at signing process.
java.security.UnrecoverableKeyException - if the private key password is not correct.
SignatureException - if any signature error occurs.
Signature sign(java.io.InputStream contentStream,
java.lang.String certificateName,
java.lang.String password,
java.lang.String contentType)
throws java.io.IOException,
SignatureException
Signature object
without timestamp.
contentStream - data stream to sign.certificateName - certificate name to use.password - private key password of the certificate to use.contentType - MIME type of the document to sign.
Signature the signature of the data stream.
java.io.IOException - if I/O errors occurs.
SignatureProviderException - if unable to access to the signature API needed provider.
SignatureSignException - if an error occurs at signing process.
java.security.UnrecoverableKeyException - if the private key password is not correct.
SignatureException - if any signature error occurs.
void signPDF(java.io.InputStream contentStream,
java.io.OutputStream signedStream,
java.lang.String certificateName,
java.lang.String password,
java.lang.String contentType,
java.lang.String url,
int position)
throws java.io.IOException,
SignatureException
url - URL address where is located the document to sign.certificateName - certificate name to use.password - private key password of the certificate to use.contentType - MIME type of the document to sign.
java.io.FileNotFoundException - if original file not found.
java.io.IOException - if I/O errors occurs.
SignatureProviderException - if unable to access to the signature API needed provider.
SignatureSignException - if an error occurs at signing process.
java.security.UnrecoverableKeyException - if the private key password is not correct.
SignatureException - if any signature error occurs.
void signPDF(java.io.InputStream contentStream,
java.io.OutputStream signedStream,
java.lang.String certificateName,
java.lang.String password,
java.lang.String contentType,
java.lang.String url,
int position,
boolean allowMultipleSignature)
throws java.io.IOException,
SignatureException
contentStream - data stream to sign.signedStream - resulting signed data stream.certificateName - certificate name to use.password - private key password of the certificate to use.contentType - MIME type of the document to sign.url - URL to add to the document.position - Position in each page of the document where the URL will be added. The possible values are:
PDF_SIGN_POSITION_TOP, PDF_SIGN_POSITION_BOTTOM, PDF_SIGN_POSITION_RIGHT o PDF_SIGN_POSITION_LEFT.allowMultipleSignature - allow to sign an already signed PDF
java.io.IOException - if I/O errors occurs.
SignatureProviderException - if unable to access to the signature API needed provider.
SignatureSignException - if an error occurs at signing process.
java.security.UnrecoverableKeyException - if the private key password is not correct.
SignatureException - if any signature error occurs.
java.io.OutputStream signPDF(java.io.InputStream contentStream,
java.lang.String certificateName,
java.lang.String password,
java.lang.String contentType,
java.lang.String url,
int position)
throws java.io.IOException,
SignatureException
contentStream - data stream to sign.certificateName - certificate name to use.password - private key password of the certificate to use.contentType - MIME type of the document to sign.url - URL to add to the document.position - Position in each page of the document where the URL will be added. The possible values are:
PDF_SIGN_POSITION_TOP, PDF_SIGN_POSITION_BOTTOM, PDF_SIGN_POSITION_RIGHT o PDF_SIGN_POSITION_LEFT.
java.io.IOException - if I/O errors occurs.
SignatureProviderException - if unable to access to the signature API needed provider.
SignatureSignException - if an error occurs at signing process.
java.security.UnrecoverableKeyException - if the private key password is not correct.
SignatureException - if any signature error occurs.
java.io.OutputStream signPDF(java.io.InputStream contentStream,
java.lang.String certificateName,
java.lang.String password,
java.lang.String contentType,
java.lang.String url,
int position,
boolean allowMultipleSignature)
throws java.io.IOException,
SignatureException
contentStream - data stream to sign.certificateName - certificate name to use.password - private key password of the certificate to use.contentType - MIME type of the document to sign.url - URL to add to the document.position - Position in each page of the document where the URL will be added. The possible values are:
PDF_SIGN_POSITION_TOP, PDF_SIGN_POSITION_BOTTOM, PDF_SIGN_POSITION_RIGHT o PDF_SIGN_POSITION_LEFT.allowMultipleSignature - allow to sign an already signed PDF
java.io.IOException - if I/O errors occurs.
SignatureProviderException - if unable to access to the signature API needed provider.
SignatureSignException - if an error occurs at signing process.
java.security.UnrecoverableKeyException - if the private key password is not correct.
SignatureException - if any signature error occurs.
void signPDF(java.io.InputStream pdfInputStream,
java.io.OutputStream signedStream,
java.lang.String certificateName,
java.lang.String password,
java.lang.String contentType,
java.lang.String textoAdicional,
int stampOptions,
float top,
float left,
float height,
float width,
float rotation,
boolean allowMultipleSignature)
throws java.io.IOException,
SignatureException
InputStream y devuelve el mismo PDF firmado
y modificado. Las opciones de firma PDF estan establecidas en la clase Signer.
pdfInputStream - signedStream - certificateName - Nombre del certificado obtenido de la llamada a Signer.getCertList()password - contraseña de la clave privada del usuariocontentType - tipo MIME del documento a firmartextoAdicional - URL en caso de estampado PDF417, o motivo de firma para firmas con estampado ABODEstampOptions - Opciones de firma PDF definidas en la clase Signertop - El 0 corresponde al borde inferior del documento.left - El 0 corresponde al borde izquierdo del documentoheight - Anchura máxima de la estampa, el texto de dividirà en las líneas necesarias para que quepa en la anchura establecida.width - Altura máxima de la estampa. Debe tenerse en cuenta que si la altura no es suficientemente grande para el texto que se divide en múltiples líneas, este se corta y desaparece.rotation - Sólo permite rotación la firma con estampado PDF417. En caso de rotación el estampado se rotarà desde la esquina inferior izquierda (top, left).allowMultipleSignature - Permitir o no refirmado del documento PDF si el documento de entrada ya está firmado
java.io.IOException
SignatureException
void certifyDigitalCopy(java.io.InputStream contentStream,
java.io.OutputStream signedStream,
java.lang.String certificateName,
java.lang.String password,
java.lang.String contentType,
java.lang.String url,
java.lang.String localidad,
float x,
float y,
float rotation)
throws java.io.IOException,
SignatureException
InputStream y devuelve el mismo PDF firmado
y modificado de forma que, en uno de los bordes del documento que se le indique, aparezca el firmante que
compulsa la copia, la url desde la que se puede consultar el PDF y una matriz de puntos en formato PDF417 que
continene esa misma URL.
contentStream - signedStream - certificateName - password - contentType - url - localidad - x - y - rotation -
java.io.IOException
SignatureException
Signature sign(java.net.URL url,
java.lang.String certificateName,
java.lang.String password,
java.lang.String contentType)
throws java.io.IOException,
SignatureException
url - URL address where is located the document to sign.certificateName - certificate name to use.password - private key password of the certificate to use.contentType - MIME type of the document to sign.
Signature the signature of the document.
java.io.FileNotFoundException - if original file not found.
java.io.IOException - if I/O errors occurs.
SignatureProviderException - if unable to access to the signature API needed provider.
SignatureSignException - if an error occurs at signing process.
java.security.UnrecoverableKeyException - if the private key password is not correct.
SignatureException - if any signature error occurs.
boolean verifyAPosterioriTimeStamp(java.io.InputStream contentStream,
Signature signatureData)
throws SignatureProviderException,
java.io.IOException,
SignatureVerifyException
contentStream - data stream of the original document.signatureData - signature to verify.
true if the verification is correct; false otherwise.
SignatureProviderException - if unable to access to the signature API needed provider.
java.io.IOException - if the document or the timestamp server is not available.
SignatureVerifyException - if an error occurs at verifying process.
boolean verifyAPosterioriTimeStamp(java.net.URL url,
Signature signatureData)
throws SignatureProviderException,
java.io.IOException,
SignatureVerifyException
url - URL of the original document.signatureData - signature to verify.
true if the verification is correct; false otherwise.
SignatureProviderException - if unable to access to the signature API needed provider.
java.io.IOException - if the document or the timestamp server is not available.
SignatureVerifyException - if an error occurs at verifying process.
boolean verifyAPosterioriTimeStamp(java.lang.String fileName,
Signature signatureData)
throws SignatureProviderException,
java.io.IOException,
SignatureVerifyException
fileName - path of the original document.signatureData - signature to verify.
true if the verification is correct; false otherwise.
SignatureProviderException - if unable to access to the signature API needed provider.
java.io.IOException - if the document or the timestamp server is not available.
SignatureVerifyException - if an error occurs at verifying process.
boolean verify(java.io.InputStream contentStream,
Signature signatureData)
throws SignatureProviderException,
java.io.IOException,
SignatureVerifyException
url - URL address where is located the original document.signatureData - signature to verify.
true if the verification is correct; false otherwise.
SignatureProviderException - if unable to access to the signature API needed provider.
java.io.IOException - if the document or the timestamp server is not available.
SignatureVerifyException - if an error occurs at verifying process.
boolean verify(java.lang.String fileName,
Signature signatureData)
throws java.io.FileNotFoundException,
SignatureProviderException,
java.io.IOException,
SignatureVerifyException
fileName - path of the original document.signatureData - signature to verify.
true if the verification is correct; false otherwise.
java.io.FileNotFoundException - if original file not found.
SignatureProviderException - if unable to access to the signature API needed provider.
java.io.IOException - if the document or the timestamp server is not available.
SignatureVerifyException - if an error occurs at verifying process.
boolean verify(java.net.URL url,
Signature signatureData)
throws SignatureProviderException,
java.io.IOException,
SignatureVerifyException
url - URL address where is located the original document.signatureData - signature to verify.
true if the verification is correct; false otherwise.
java.io.FileNotFoundException - if original file not found.
SignatureProviderException - if unable to access to the signature API needed provider.
java.io.IOException - if the document or the timestamp server is not available.
SignatureVerifyException - if an error occurs at verifying process.
void generateSMIME(java.io.InputStream document,
Signature signature,
java.io.OutputStream smime)
throws java.io.IOException
smime - output stream to write the generated SMIME document.signature - digital signature of the document.document - input stream of the original document.
java.io.IOException - if I/O errors occurs.
void generateSMIMEParalell(java.io.InputStream document,
Signature[] signatures,
java.io.OutputStream smime)
throws java.io.IOException,
SignatureException
document - InputStream con el documento que se firmósignatures - firmas digital del documentosmime - OutputStream con el SMIME obtenido
java.io.IOException
SignatureException
java.util.Date getCurrentDate(java.lang.String certificateName,
java.lang.String password,
java.lang.String contentType)
throws SignatureTimestampException,
SignatureException,
java.io.IOException
certificateName - nombre del certificado que se usará para firmarpassword - contraseña de la clave privada del usuariocontentType - tipo MIME del documento a firmar
java.io.IOException
SignatureException
SignatureTimestampExceptionjava.lang.String getAPIVersion()
SMIMEParser getSMIMEParser(java.io.InputStream smime)
throws java.io.FileNotFoundException,
java.lang.InstantiationException,
java.lang.IllegalAccessException,
java.io.IOException,
SignatureException
smime - the SMIME document to read.
java.io.FileNotFoundException - if smime file not found.
java.lang.InstantiationException - if problems instanciating the SMIMEParserObject.
java.lang.IllegalAccessException - if problems instanciating the SMIMEParserObject.
java.io.IOException - if I/O errors occurs.
SignatureException - if any signature error occurs.ParsedCertificate parseCertificate(java.security.cert.X509Certificate certificateChain)
certificate - Certificat to parse.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||