Package pt.gov.cartaodecidadao
Class PTEID_SigningDeviceProxy
java.lang.Object
pt.gov.cartaodecidadao.PTEID_SigningDeviceProxy
- All Implemented Interfaces:
PTEID_SigningDevice
Interface class for objects with Signing capabilities.
- Since:
- 3.8.0
-
Method Summary
Modifier and TypeMethodDescriptionvoiddelete()Deprecated.getCA()Deprecated.Use getCertificates() to obtain the certificates and obtain the desired certificate/build the chain
manually.getCert(PTEID_CertifType type) Deprecated.Use getCertificates() to obtain the certificates and obtain the desired certificate/build the chain
manually.Deprecated.Use getCertificates() to obtain the certificates and obtain the desired certificate/build the chain
manually.Get type of SigningDeviceType.getRoot()Deprecated.Use getCertificates() to obtain the certificates and obtain the desired certificate/build the chain
manually.Deprecated.Use getCertificates() to obtain the certificates and obtain the desired certificate/build the chain
manually.longSign(PTEID_ByteArray data) Raw RSA signature with PKCS #1 padding.Sign(PTEID_ByteArray data, boolean signatureKey) Raw RSA signature with PKCS #1 padding.voidvoidSignASiC(String path, PTEID_SignatureLevel level) intSignPDF(PTEID_PDFSignature sig_handler, int page, double coord_x, double coord_y, String location, String reason, 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, String location, String reason, String outfile_path) Deprecated.use the SignPDF function with location coordinates insteadSignSHA256(PTEID_ByteArray data) Deprecated.This method is now deprecated.SignSHA256(PTEID_ByteArray data, boolean signatureKey) Deprecated.This method is now deprecated.Produce a XAdES Signature of the files indicated by the parameter paths and stores the results in one ASiC
container in a zip format.SignXades(String output_path, 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.SignXadesA(String output_path, String[] paths, long n_paths) Deprecated.use the SignXades function and set signature level with level (PTEID_SignatureLevel) parameter
insteadvoidSignXadesAIndividual(String output_path, 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.voidSignXadesIndividual(String output_path, 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.
SignXadesT(String output_path, String[] paths, long n_paths) Deprecated.use the SignXades function and set signature level with level (PTEID_SignatureLevel) parameter
insteadvoidSignXadesTIndividual(String output_path, 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.
-
Method Details
-
delete
public void delete() -
PTEID_SigningDevice_GetInterfaceCPtr
public long PTEID_SigningDevice_GetInterfaceCPtr()- Specified by:
PTEID_SigningDevice_GetInterfaceCPtrin interfacePTEID_SigningDevice
-
Sign
Raw RSA signature with PKCS #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
Raw RSA signature with PKCS #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 PKCS #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
Deprecated.This method is now deprecated. Use PTEID_SigningDevice::Sign method instead, which already supports
SHA256.Raw RSA signature with PKCS #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(String output_path, 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:
output_path- points to the resulting containerpaths- 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 arraylevel- 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(String output_path, 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:
output_path- points to the resulting containerpaths- 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 array- Throws:
PTEID_Exception
-
SignXadesT
public PTEID_ByteArray SignXadesT(String output_path, 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:
output_path- points to the resulting containerpaths- 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 array- Throws:
PTEID_Exception
-
SignXadesA
public PTEID_ByteArray SignXadesA(String output_path, 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:
output_path- points to the resulting containerpaths- 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 array- Throws:
PTEID_Exception
-
SignXadesIndividual
public void SignXadesIndividual(String output_path, 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:
SignXadesIndividualin interfacePTEID_SigningDevice- Parameters:
output_path- directory of the created ASiC containerspaths- 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 array- Throws:
PTEID_Exception
-
SignXadesTIndividual
public void SignXadesTIndividual(String output_path, 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:
SignXadesTIndividualin interfacePTEID_SigningDevice- Parameters:
output_path- directory of the created ASiC containerspaths- 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 array- Throws:
PTEID_Exception
-
SignXadesAIndividual
public void SignXadesAIndividual(String output_path, 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:
SignXadesAIndividualin interfacePTEID_SigningDevice- Parameters:
output_path- directory of the created ASiC containerspaths- 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 array- Throws:
PTEID_Exception
-
SignASiC
- Specified by:
SignASiCin interfacePTEID_SigningDevice
-
SignASiC
- Specified by:
SignASiCin interfacePTEID_SigningDevice
-
SignPDF
public int SignPDF(PTEID_PDFSignature sig_handler, int page, int page_sector, boolean is_landscape, String location, String reason, 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, String location, String reason, 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
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
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
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
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
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
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
Get type of SigningDeviceType.- Specified by:
getDeviceTypein interfacePTEID_SigningDevice
-
manually.