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 void
delete()
PTEID_Certificate
getAuthentication()
Deprecated.Use getCertificates() to obtain the certificates and obtain the desired certificate/build the chain manually.PTEID_Certificate
getCA()
Deprecated.Use getCertificates() to obtain the certificates and obtain the desired certificate/build the chain manually.PTEID_Certificate
getCert(PTEID_CertifType type)
Deprecated.Use getCertificates() to obtain the certificates and obtain the desired certificate/build the chain manually.PTEID_Certificates
getCertificates()
Deprecated.Use getCertificates() to obtain the certificates and obtain the desired certificate/build the chain manually.PTEID_SigningDeviceType
getDeviceType()
Get type of SigningDeviceType.PTEID_Certificate
getRoot()
Deprecated.Use getCertificates() to obtain the certificates and obtain the desired certificate/build the chain manually.PTEID_Certificate
getSignature()
Deprecated.Use getCertificates() to obtain the certificates and obtain the desired certificate/build the chain manually.long
PTEID_SigningDevice_GetInterfaceCPtr()
PTEID_ByteArray
Sign(PTEID_ByteArray data)
Raw RSA signature with PCKS #1 padding.PTEID_ByteArray
Sign(PTEID_ByteArray data, boolean signatureKey)
Raw RSA signature with PCKS #1 padding.void
SignASiC(java.lang.String path)
void
SignASiC(java.lang.String path, PTEID_SignatureLevel level)
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)
PDF Signature with location by coordinates (expressed in percentage of page height/width).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)
Deprecated.use the SignPDF function with location coordinates insteadPTEID_ByteArray
SignSHA256(PTEID_ByteArray data)
Deprecated.This method is now deprecated.PTEID_ByteArray
SignSHA256(PTEID_ByteArray data, boolean signatureKey)
Deprecated.This method is now deprecated.PTEID_ByteArray
SignXades(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_ByteArray
SignXades(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_ByteArray
SignXadesA(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 insteadvoid
SignXadesAIndividual(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.
void
SignXadesIndividual(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_ByteArray
SignXadesT(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 insteadvoid
SignXadesTIndividual(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_GetInterfaceCPtr
in interfacePTEID_SigningDevice
-
Sign
public PTEID_ByteArray Sign(PTEID_ByteArray data, boolean signatureKey) throws PTEID_Exception
Raw RSA signature with PCKS #1 padding.- Specified by:
Sign
in 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:
Sign
in 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:
SignSHA256
in 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:
SignSHA256
in 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:
SignXades
in 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:
SignXades
in 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:
SignXadesT
in 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:
SignXadesA
in 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_Exception
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.
- Specified by:
SignXadesIndividual
in 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_Exception
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.
- Specified by:
SignXadesTIndividual
in 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_Exception
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.
- Specified by:
SignXadesAIndividual
in 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:
SignASiC
in interfacePTEID_SigningDevice
-
SignASiC
public void SignASiC(java.lang.String path)
- Specified by:
SignASiC
in 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:
SignPDF
in 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:
SignPDF
in 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:
getCertificates
in 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:
getCert
in 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:
getRoot
in 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:
getCA
in 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:
getSignature
in 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:
getAuthentication
in interfacePTEID_SigningDevice
- Throws:
PTEID_Exception
-
getDeviceType
public PTEID_SigningDeviceType getDeviceType()
Get type of SigningDeviceType.- Specified by:
getDeviceType
in interfacePTEID_SigningDevice
-
-