|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectes.caib.signatura.impl.CAIBSigner
public class CAIBSigner
Implementator class of the Signer interface.
| Field Summary |
|---|
| Fields inherited from interface es.caib.signatura.api.Signer |
|---|
PDF_SIGN_DEFAULT_SIGNATURE_APPERANCE, PDF_SIGN_PAGE_LAST, PDF_SIGN_PDF417_SIGNATURE_APPERANCE, PDF_SIGN_POSITION_BOTTOM, PDF_SIGN_POSITION_LEFT, PDF_SIGN_POSITION_NONE, PDF_SIGN_POSITION_RIGHT, PDF_SIGN_POSITION_TOP |
| Constructor Summary | |
|---|---|
CAIBSigner()
Deprecated. |
|
CAIBSigner(java.util.Map signerConfiguration)
|
|
CAIBSigner(java.lang.String updateSite,
java.net.URL configurationFile,
java.lang.String propertiesCachePath)
|
|
| 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)
Compulsa de un documento PDF |
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. |
static java.lang.String |
getWindowsShortPath(java.io.File f)
|
protected void |
initialize()
|
ParsedCertificate |
parseCertificate(java.security.cert.X509Certificate certificate)
Returns basic certificate information. |
protected void |
preInitialize()
|
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)
Firma un PDF sin soporte para múltiples firmas. |
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)
Firma un PDF dejando la opción de si se soportan múltiples firmas o no (parámetro allowMultipleSignature). |
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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CAIBSigner()
throws java.io.FileNotFoundException
java.io.FileNotFoundException
public CAIBSigner(java.lang.String updateSite,
java.net.URL configurationFile,
java.lang.String propertiesCachePath)
throws java.io.FileNotFoundException
updateSite - configurationFile - propertiesCachePath -
java.io.FileNotFoundException
public CAIBSigner(java.util.Map signerConfiguration)
throws java.io.FileNotFoundException
signerConfiguration -
java.io.FileNotFoundException| Method Detail |
|---|
public java.lang.String[] getCertList(java.lang.String contentType)
throws SignatureCertNotFoundException,
SignaturePrivKeyException
Signer
getCertList in interface SignerSignatureCertNotFoundException - if no available certificates.
SignaturePrivKeyException - if unable to access to private keys.
public Signature sign(java.lang.String fileName,
java.lang.String certificateName,
java.lang.String password,
java.lang.String contentType)
throws java.io.IOException,
SignatureException
Signer
sign in interface SignerfileName - 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.
SignatureException - if any signature error occurs.
public Signature sign(java.io.InputStream contentStream,
java.lang.String certificateName,
java.lang.String password,
java.lang.String contentType)
throws java.io.IOException,
SignatureException
SignerSignature object
without timestamp.
sign in interface SignercontentStream - 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.
SignatureException - if any signature error occurs.
public Signature sign(java.net.URL url,
java.lang.String certificateName,
java.lang.String password,
java.lang.String contentType)
throws java.io.IOException,
SignatureException
Signer
sign in interface Signerurl - 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.
SignatureException - if any signature error occurs.
public 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
signPDF in interface SignercontentStream - 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.
SignatureException - if any signature error occurs.
public 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
SignerInputStream y devuelve el mismo PDF firmado
y modificado. Las opciones de firma PDF estan establecidas en la clase Signer.
signPDF in interface SignercertificateName - 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
public 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
signPDF in interface SignercertificateName - certificate name to use.password - private key password of the certificate to use.contentType - MIME type of the document to sign.url - URL address where is located 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.
SignatureException - if any signature error occurs.
public 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
signPDF in interface SignercontentStream - 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.
SignatureException - if any signature error occurs.
public 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
signPDF in interface SignercontentStream - 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.
SignatureException - if any signature error occurs.
public 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
certifyDigitalCopy in interface Signerjava.io.IOException
SignatureException
public boolean verify(java.io.InputStream contentStream,
Signature signatureData)
throws SignatureProviderException,
java.io.IOException,
SignatureVerifyException
Signer
verify in interface SignersignatureData - 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.
public boolean verifyAPosterioriTimeStamp(java.io.InputStream contentStream,
Signature signatureData)
throws SignatureProviderException,
java.io.IOException,
SignatureVerifyException
Signer
verifyAPosterioriTimeStamp in interface SignercontentStream - 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.
public boolean verify(java.lang.String fileName,
Signature signatureData)
throws java.io.FileNotFoundException,
SignatureProviderException,
java.io.IOException,
SignatureVerifyException
Signer
verify in interface SignerfileName - 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.
public boolean verify(java.net.URL url,
Signature signatureData)
throws SignatureProviderException,
java.io.IOException,
SignatureVerifyException
Signer
verify in interface Signerurl - 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.FileNotFoundException - if original file not found.
java.io.IOException - if the document or the timestamp server is not available.
SignatureVerifyException - if an error occurs at verifying process.
public boolean verifyAPosterioriTimeStamp(java.lang.String fileName,
Signature signatureData)
throws java.io.FileNotFoundException,
SignatureProviderException,
java.io.IOException,
SignatureVerifyException
Signer
verifyAPosterioriTimeStamp in interface SignerfileName - 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.
java.io.FileNotFoundException
public boolean verifyAPosterioriTimeStamp(java.net.URL url,
Signature signatureData)
throws SignatureProviderException,
java.io.IOException,
SignatureVerifyException
Signer
verifyAPosterioriTimeStamp in interface Signerurl - 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.
public void generateSMIME(java.io.InputStream document,
Signature signature,
java.io.OutputStream smime)
throws java.io.IOException
Signer
generateSMIME in interface Signerdocument - input stream of the original document.signature - digital signature of the document.smime - output stream to write the generated SMIME document.
java.io.IOException - if I/O errors occurs.
public void generateSMIMEParalell(java.io.InputStream document,
Signature[] signatures,
java.io.OutputStream smime)
throws java.io.IOException,
SignatureException
Signer
generateSMIMEParalell in interface Signerdocument - InputStream con el documento que se firmósignatures - firmas digital del documentosmime - OutputStream con el SMIME obtenido
java.io.IOException
SignatureException
public java.util.Date getCurrentDate(java.lang.String certificateName,
java.lang.String password,
java.lang.String contentType)
throws SignatureTimestampException,
SignatureException,
java.io.IOException
Signer
getCurrentDate in interface SignercertificateName - nombre del certificado que se usará para firmarpassword - contraseña de la clave privada del usuariocontentType - tipo MIME del documento a firmar
SignatureException
java.io.IOException
SignatureTimestampExceptionpublic java.lang.String getAPIVersion()
Signer
getAPIVersion in interface Signer
protected void preInitialize()
throws java.io.FileNotFoundException
java.io.FileNotFoundException
protected void initialize()
throws java.io.FileNotFoundException
java.io.FileNotFoundException
public SMIMEParser getSMIMEParser(java.io.InputStream smime)
throws java.lang.InstantiationException,
java.lang.IllegalAccessException,
java.io.IOException,
SignatureException
Signer
getSMIMEParser in interface Signersmime - the SMIME document to read.
java.lang.InstantiationException - if problems instanciating the SMIMEParserObject.
java.lang.IllegalAccessException - if problems instanciating the SMIMEParserObject.
java.io.FileNotFoundException - if smime file not found.
java.io.IOException - if I/O errors occurs.
SignatureException - if any signature error occurs.public ParsedCertificate parseCertificate(java.security.cert.X509Certificate certificate)
Signer
parseCertificate in interface Signer
public static java.lang.String getWindowsShortPath(java.io.File f)
throws java.io.FileNotFoundException
java.io.FileNotFoundException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||