Package pt.gov.cartaodecidadao
Class PTEID_SigningDeviceProxy
- java.lang.Object
-
- pt.gov.cartaodecidadao.PTEID_SigningDeviceProxy
-
- All Implemented Interfaces:
PTEID_SigningDevice
public class PTEID_SigningDeviceProxy extends java.lang.Object implements PTEID_SigningDevice
Interface class for objects with Signing capabilities.- Since:
- 3.8.0
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voiddelete()PTEID_CertificategetAuthentication()Deprecated.Use getCertificates() to obtain the certificates and obtain the desired certificate/build the chain manually.PTEID_CertificategetCA()Deprecated.Use getCertificates() to obtain the certificates and obtain the desired certificate/build the chain manually.PTEID_CertificategetCert(PTEID_CertifType type)Deprecated.Use getCertificates() to obtain the certificates and obtain the desired certificate/build the chain manually.PTEID_CertificatesgetCertificates()Deprecated.Use getCertificates() to obtain the certificates and obtain the desired certificate/build the chain manually.PTEID_SigningDeviceTypegetDeviceType()Get type of SigningDeviceType.PTEID_CertificategetRoot()Deprecated.Use getCertificates() to obtain the certificates and obtain the desired certificate/build the chain manually.PTEID_CertificategetSignature()Deprecated.Use getCertificates() to obtain the certificates and obtain the desired certificate/build the chain manually.longPTEID_SigningDevice_GetInterfaceCPtr()PTEID_ByteArraySign(PTEID_ByteArray data)Raw RSA signature with PCKS #1 padding.PTEID_ByteArraySign(PTEID_ByteArray data, boolean signatureKey)Raw RSA signature with PCKS #1 padding.voidSignASiC(java.lang.String path)voidSignASiC(java.lang.String path, PTEID_SignatureLevel level)intSignPDF(PTEID_PDFSignature sig_handler, int page, double coord_x, double coord_y, java.lang.String location, java.lang.String reason, java.lang.String outfile_path)PDF Signature with location by coordinates (expressed in percentage of page height/width).intSignPDF(PTEID_PDFSignature sig_handler, int page, int page_sector, boolean is_landscape, java.lang.String location, java.lang.String reason, java.lang.String outfile_path)Deprecated.use the SignPDF function with location coordinates insteadPTEID_ByteArraySignSHA256(PTEID_ByteArray data)Deprecated.This method is now deprecated.PTEID_ByteArraySignSHA256(PTEID_ByteArray data, boolean signatureKey)Deprecated.This method is now deprecated.PTEID_ByteArraySignXades(java.lang.String output_path, java.lang.String[] paths, long n_paths)Produce a XAdES Signature of the files indicated by the parameter paths and stores the results in one ASiC container in a zip format.PTEID_ByteArraySignXades(java.lang.String output_path, java.lang.String[] paths, long n_paths, PTEID_SignatureLevel level)Produce a XAdES Signature of the files indicated by the parameter paths and stores the results in one ASiC container in a zip format.PTEID_ByteArraySignXadesA(java.lang.String output_path, java.lang.String[] paths, long n_paths)Deprecated.use the SignXades function and set signature level with level (PTEID_SignatureLevel) parameter insteadvoidSignXadesAIndividual(java.lang.String output_path, java.lang.String[] paths, long n_paths)Produce XAdES-A Signatures of the files indicated by the parameter paths and stores each of the results in an individual ASiC container in a zip format.
If PTEID_Exception(EIDMW_TIMESTAMP_ERROR) is thrown, the resulting file is a XAdES-B signature.
If PTEID_Exception(EIDMW_LTV_ERROR) is thrown, the resulting file is a XAdES-LT or XAdES-LTA depending where the timestamping fails.
voidSignXadesIndividual(java.lang.String output_path, java.lang.String[] paths, long n_paths)Produce XAdES-B Signatures of the files indicated by the parameter paths and stores each of the results in an individual ASiC container in a zip format.
PTEID_ByteArraySignXadesT(java.lang.String output_path, java.lang.String[] paths, long n_paths)Deprecated.use the SignXades function and set signature level with level (PTEID_SignatureLevel) parameter insteadvoidSignXadesTIndividual(java.lang.String output_path, java.lang.String[] paths, long n_paths)Produce XAdES-T Signatures of the files indicated by the parameter paths and stores each of the results in an individual ASiC container in a zip format.
If PTEID_Exception(EIDMW_TIMESTAMP_ERROR) is thrown, the resulting file is a XAdES-B signature.
-
-
-
Method Detail
-
delete
public void delete()
-
PTEID_SigningDevice_GetInterfaceCPtr
public long PTEID_SigningDevice_GetInterfaceCPtr()
- Specified by:
PTEID_SigningDevice_GetInterfaceCPtrin interfacePTEID_SigningDevice
-
Sign
public PTEID_ByteArray Sign(PTEID_ByteArray data, boolean signatureKey) throws PTEID_Exception
Raw RSA signature with PCKS #1 padding.- Specified by:
Signin interfacePTEID_SigningDevice- Parameters:
data- holds the data to be signed, at most 32 bytes. This data should be hashed using sha256.signatureKey- whether to use the 'Signature key'. By default, it uses the 'Authentication private key'. To sign with the 'Signature private key' set the parameter signatureKey to true.- Returns:
- A PTEID_ByteArray containing the signed data.
- Throws:
PTEID_Exception
-
Sign
public PTEID_ByteArray Sign(PTEID_ByteArray data) throws PTEID_Exception
Raw RSA signature with PCKS #1 padding.- Specified by:
Signin interfacePTEID_SigningDevice- Parameters:
data- holds the data to be signed, at most 32 bytes. This data should be hashed using sha256.
- Returns:
- A PTEID_ByteArray containing the signed data.
- Throws:
PTEID_Exception
-
SignSHA256
public PTEID_ByteArray SignSHA256(PTEID_ByteArray data, boolean signatureKey) throws PTEID_Exception
Deprecated.This method is now deprecated. Use PTEID_SigningDevice::Sign method instead, which already supports SHA256.Raw RSA signature with PCKS #1 padding (applied to a SHA256 hash).- Specified by:
SignSHA256in interfacePTEID_SigningDevice- Parameters:
data- holds the data to be signed, it should be 32 bytes.signatureKey- whether to use the 'Signature key'. By default, it uses the 'Authentication private key'. To sign with the 'Signature private key' set the parameter signatureKey to true.- Returns:
- A PTEID_ByteArray containing the signed data.
- Throws:
PTEID_Exception
-
SignSHA256
public PTEID_ByteArray SignSHA256(PTEID_ByteArray data) throws PTEID_Exception
Deprecated.This method is now deprecated. Use PTEID_SigningDevice::Sign method instead, which already supports SHA256.Raw RSA signature with PCKS #1 padding (applied to a SHA256 hash).- Specified by:
SignSHA256in interfacePTEID_SigningDevice- Parameters:
data- holds the data to be signed, it should be 32 bytes.
- Returns:
- A PTEID_ByteArray containing the signed data.
- Throws:
PTEID_Exception
-
SignXades
public PTEID_ByteArray SignXades(java.lang.String output_path, java.lang.String[] paths, long n_paths, PTEID_SignatureLevel level) throws PTEID_Exception
Produce a XAdES Signature of the files indicated by the parameter paths and stores the results in one ASiC container in a zip format. The location of the resulting ASiC container is indicated by the parameter output_path.
- Specified by:
SignXadesin interfacePTEID_SigningDevice- Parameters:
paths- is an array of null-terminated strings representing absolute paths in
the local filesystem. Those files content (hashed with SHA-256 algorithm) will be the input data for the RSA signaturen_paths- is the number of elements in the paths arrayoutput_path- points to the resulting containerlevel- is an enum used to set the XAdES signature level/profile: XAdES-B (PTEID_LEVEL_BASIC), XAdES-T (PTEID_LEVEL_T), XAdES-LTA (PTEID_LEVEL_LTV). Note: Setting parameter level to PTEID_LEVEL_LT will throw PTEID_Exception(EIDMW_ERR_PARAM_BAD), as it is not supported yet.- Throws:
PTEID_Exception
-
SignXades
public PTEID_ByteArray SignXades(java.lang.String output_path, java.lang.String[] paths, long n_paths) throws PTEID_Exception
Produce a XAdES Signature of the files indicated by the parameter paths and stores the results in one ASiC container in a zip format. The location of the resulting ASiC container is indicated by the parameter output_path.
- Specified by:
SignXadesin interfacePTEID_SigningDevice- Parameters:
paths- is an array of null-terminated strings representing absolute paths in
the local filesystem. Those files content (hashed with SHA-256 algorithm) will be the input data for the RSA signaturen_paths- is the number of elements in the paths arrayoutput_path- points to the resulting container- Throws:
PTEID_Exception
-
SignXadesT
public PTEID_ByteArray SignXadesT(java.lang.String output_path, java.lang.String[] paths, long n_paths) throws PTEID_Exception
Deprecated.use the SignXades function and set signature level with level (PTEID_SignatureLevel) parameter insteadProduce a XAdES-T Signature of the files indicated by the parameter paths and stores the results in one ASiC container in a zip format. The location of the resulting ASiC container is indicated by the parameter output_path.
If PTEID_Exception(EIDMW_TIMESTAMP_ERROR) is thrown, the resulting file is a XAdES-B signature.
- Specified by:
SignXadesTin interfacePTEID_SigningDevice- Parameters:
paths- is an array of null-terminated strings representing absolute paths in
the local filesystem. Those files content (hashed with SHA-256 algorithm) will be the input data for the RSA signaturen_paths- is the number of elements in the paths arrayoutput_path- points to the resulting container- Throws:
PTEID_Exception
-
SignXadesA
public PTEID_ByteArray SignXadesA(java.lang.String output_path, java.lang.String[] paths, long n_paths) throws PTEID_Exception
Deprecated.use the SignXades function and set signature level with level (PTEID_SignatureLevel) parameter insteadProduce a XAdES-LTA Signature of the files indicated by the parameter paths and stores the results in one ASiC container in a zip format. The location of the resulting ASiC container is indicated by the parameter output_path.
If PTEID_Exception(EIDMW_TIMESTAMP_ERROR) is thrown, the resulting file is a XAdES-B signature.
If PTEID_Exception(EIDMW_LTV_ERROR) is thrown, the resulting file is a XAdES-LT or XAdES-LTA depending where the timestamping fails.
- Specified by:
SignXadesAin interfacePTEID_SigningDevice- Parameters:
paths- is an array of null-terminated strings representing absolute paths in
the local filesystem. Those files content (hashed with SHA-256 algorithm) will be the input data for the RSA signaturen_paths- is the number of elements in the paths arrayoutput_path- points to the resulting container- Throws:
PTEID_Exception
-
SignXadesIndividual
public void SignXadesIndividual(java.lang.String output_path, java.lang.String[] paths, long n_paths) throws PTEID_ExceptionProduce XAdES-B Signatures of the files indicated by the parameter paths and stores each of the results in an individual ASiC container in a zip format.
- Specified by:
SignXadesIndividualin interfacePTEID_SigningDevice- Parameters:
paths- is an array of null-terminated strings representing absolute paths in
the local filesystem. Those files content (hashed with SHA-256 algorithm) will be the input data for the RSA signaturen_paths- is the number of elements in the paths arrayoutput_path- directory of the created ASiC containers- Throws:
PTEID_Exception
-
SignXadesTIndividual
public void SignXadesTIndividual(java.lang.String output_path, java.lang.String[] paths, long n_paths) throws PTEID_ExceptionProduce XAdES-T Signatures of the files indicated by the parameter paths and stores each of the results in an individual ASiC container in a zip format.
If PTEID_Exception(EIDMW_TIMESTAMP_ERROR) is thrown, the resulting file is a XAdES-B signature.
- Specified by:
SignXadesTIndividualin interfacePTEID_SigningDevice- Parameters:
paths- is an array of null-terminated strings representing absolute paths in
the local filesystem. Those files content (hashed with SHA-256 algorithm) will be the input data for the RSA signaturen_paths- is the number of elements in the paths arrayoutput_path- directory of the created ASiC containers- Throws:
PTEID_Exception
-
SignXadesAIndividual
public void SignXadesAIndividual(java.lang.String output_path, java.lang.String[] paths, long n_paths) throws PTEID_ExceptionProduce XAdES-A Signatures of the files indicated by the parameter paths and stores each of the results in an individual ASiC container in a zip format.
If PTEID_Exception(EIDMW_TIMESTAMP_ERROR) is thrown, the resulting file is a XAdES-B signature.
If PTEID_Exception(EIDMW_LTV_ERROR) is thrown, the resulting file is a XAdES-LT or XAdES-LTA depending where the timestamping fails.
- Specified by:
SignXadesAIndividualin interfacePTEID_SigningDevice- Parameters:
paths- is an array of null-terminated strings representing absolute paths in
the local filesystem. Those files content (hashed with SHA-256 algorithm) will be the input data for the RSA signaturen_paths- is the number of elements in the paths arrayoutput_path- directory of the created ASiC containers- Throws:
PTEID_Exception
-
SignASiC
public void SignASiC(java.lang.String path, PTEID_SignatureLevel level)- Specified by:
SignASiCin interfacePTEID_SigningDevice
-
SignASiC
public void SignASiC(java.lang.String path)
- Specified by:
SignASiCin interfacePTEID_SigningDevice
-
SignPDF
public int SignPDF(PTEID_PDFSignature sig_handler, int page, int page_sector, boolean is_landscape, java.lang.String location, java.lang.String reason, java.lang.String outfile_path) throws PTEID_Exception
Deprecated.use the SignPDF function with location coordinates insteadPDF Signature with location by page sector (the portrait A4 page is split into 18 cells: 6 lines and 3 columns)
If PTEID_Exception(EIDMW_TIMESTAMP_ERROR) is thrown, the resulting file is a PAdES-B signature.
If PTEID_Exception(EIDMW_LTV_ERROR) is thrown, the resulting file is a PAdES-LT or PAdES-LTA depending where the timestamping fails.
- Specified by:
SignPDFin interfacePTEID_SigningDevice- Parameters:
sig_handler- : this defines the input file and some signature optionspage- : in case of visible signature it defines the page where the signature will appearpage_sector- : position in the signature grid, between 1 to 18 for Portrait documents and 1 to 20 for Landscape onesis_landscape- : is unused parameter, the SDK now detects document orientation automaticallylocation- : Signature metadata fieldreason- : Signature metadata fieldoutfile_path- : Native Filesystem path of the ouput file- Throws:
PTEID_Exception
-
SignPDF
public int SignPDF(PTEID_PDFSignature sig_handler, int page, double coord_x, double coord_y, java.lang.String location, java.lang.String reason, java.lang.String outfile_path) throws PTEID_Exception
PDF Signature with location by coordinates (expressed in percentage of page height/width). The coordinate system has its origin in the top left corner of the page
If PTEID_Exception(EIDMW_TIMESTAMP_ERROR) is thrown, the resulting file is a PAdES-B signature.
If PTEID_Exception(EIDMW_LTV_ERROR) is thrown, the resulting file is a PAdES-LT or PAdES-LTA depending where the timestamping fails.
- Specified by:
SignPDFin interfacePTEID_SigningDevice- Parameters:
sig_handler- : this defines the input file and some signature optionspage- : in case of visible signature it defines the page where the signature will appearcoord_x- : X coordinate of the signature location (percentage of page width)coord_y- : Y coordinate of the signature location (percentage of page height)location- : Location field in the added signature metadatareason- : Signature metadata fieldoutfile_path- : Native Filesystem path of the ouput file- Throws:
PTEID_Exception
-
getCertificates
public PTEID_Certificates getCertificates() throws PTEID_Exception
Deprecated.Use getCertificates() to obtain the certificates and obtain the desired certificate/build the chain manually.- Specified by:
getCertificatesin interfacePTEID_SigningDevice- Throws:
PTEID_Exception
-
getCert
public PTEID_Certificate getCert(PTEID_CertifType type) throws PTEID_Exception
Deprecated.Use getCertificates() to obtain the certificates and obtain the desired certificate/build the chain manually.- Specified by:
getCertin interfacePTEID_SigningDevice- Throws:
PTEID_Exception
-
getRoot
public PTEID_Certificate getRoot() throws PTEID_Exception
Deprecated.Use getCertificates() to obtain the certificates and obtain the desired certificate/build the chain manually.- Specified by:
getRootin interfacePTEID_SigningDevice- Throws:
PTEID_Exception
-
getCA
public PTEID_Certificate getCA() throws PTEID_Exception
Deprecated.Use getCertificates() to obtain the certificates and obtain the desired certificate/build the chain manually.- Specified by:
getCAin interfacePTEID_SigningDevice- Throws:
PTEID_Exception
-
getSignature
public PTEID_Certificate getSignature() throws PTEID_Exception
Deprecated.Use getCertificates() to obtain the certificates and obtain the desired certificate/build the chain manually.- Specified by:
getSignaturein interfacePTEID_SigningDevice- Throws:
PTEID_Exception
-
getAuthentication
public PTEID_Certificate getAuthentication() throws PTEID_Exception
Deprecated.Use getCertificates() to obtain the certificates and obtain the desired certificate/build the chain manually.- Specified by:
getAuthenticationin interfacePTEID_SigningDevice- Throws:
PTEID_Exception
-
getDeviceType
public PTEID_SigningDeviceType getDeviceType()
Get type of SigningDeviceType.- Specified by:
getDeviceTypein interfacePTEID_SigningDevice
-
-