Package pt.gov.cartaodecidadao
Class PTEID_CMDSignatureClient
- java.lang.Object
-
- pt.gov.cartaodecidadao.PTEID_Object
-
- pt.gov.cartaodecidadao.PTEID_CMDSignatureClient
-
- All Implemented Interfaces:
PTEID_SigningDevice
public class PTEID_CMDSignatureClient extends PTEID_Object implements PTEID_SigningDevice
This class is a client for signing with Chave Móvel Digital.- Since:
- 3.8.0
-
-
Constructor Summary
Constructors Constructor Description PTEID_CMDSignatureClient()
Default constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
delete()
PTEID_Certificate
getAuthentication()
PTEID_Certificate
getCA()
PTEID_Certificate
getCert(PTEID_CertifType type)
PTEID_Certificates
getCertificates()
This method returns the certificates for the account used in the last signature performed by this client.
If no signature was made, it will open a dialog to introduce the CMD credentials for the account of the certificates to be obtained.PTEID_SigningDeviceType
getDeviceType()
PTEID_Certificate
getRoot()
PTEID_Certificate
getSignature()
long
PTEID_SigningDevice_GetInterfaceCPtr()
static void
setCredentials(java.lang.String basicAuthUser, java.lang.String basicAuthPassword, java.lang.String applicationId)
Set the credentials for the CMD services.
The credentials must be set once before using the CMD services and will be used for every instance of PTEID_CMDSignatureClient.void
setMobileNumberCaching(boolean enabled)
If setMobileNumberCaching is enabled, the mobile number used in a previous signature with this instance is
cached and displayed in the signature dialog as a placeholder.PTEID_ByteArray
Sign(PTEID_ByteArray data)
The PTEID_CMDSignatureClient class only supports signature key.PTEID_ByteArray
Sign(PTEID_ByteArray data, boolean signatureKey)
The PTEID_CMDSignatureClient class only supports signature key.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)
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)
PTEID_ByteArray
SignSHA256(PTEID_ByteArray data)
Deprecated.Use PTEID_CMDSignatureClient::Sign instead.
The PTEID_CMDSignatureClient class only supports signature key.PTEID_ByteArray
SignSHA256(PTEID_ByteArray data, boolean signatureKey)
Deprecated.Use PTEID_CMDSignatureClient::Sign instead.
The PTEID_CMDSignatureClient class only supports signature key.PTEID_ByteArray
SignXades(java.lang.String output_path, java.lang.String[] paths, long n_paths)
PTEID_ByteArray
SignXades(java.lang.String output_path, java.lang.String[] paths, long n_paths, PTEID_SignatureLevel level)
PTEID_ByteArray
SignXadesA(java.lang.String output_path, java.lang.String[] paths, long n_paths)
Warning: This method is not implemented for PTEID_CMDSignatureClient.void
SignXadesAIndividual(java.lang.String output_path, java.lang.String[] paths, long n_paths)
Warning: This method is not implemented for PTEID_CMDSignatureClient.void
SignXadesIndividual(java.lang.String output_path, java.lang.String[] paths, long n_paths)
Warning: This method is not implemented for PTEID_CMDSignatureClient.PTEID_ByteArray
SignXadesT(java.lang.String output_path, java.lang.String[] paths, long n_paths)
Warning: This method is not implemented for PTEID_CMDSignatureClient.void
SignXadesTIndividual(java.lang.String output_path, java.lang.String[] paths, long n_paths)
Warning: This method is not implemented for PTEID_CMDSignatureClient.
-
-
-
Method Detail
-
delete
public void delete()
- Overrides:
delete
in classPTEID_Object
-
PTEID_SigningDevice_GetInterfaceCPtr
public long PTEID_SigningDevice_GetInterfaceCPtr()
- Specified by:
PTEID_SigningDevice_GetInterfaceCPtr
in interfacePTEID_SigningDevice
-
setMobileNumberCaching
public void setMobileNumberCaching(boolean enabled)
If setMobileNumberCaching is enabled, the mobile number used in a previous signature with this instance is
cached and displayed in the signature dialog as a placeholder.
-
Sign
public PTEID_ByteArray Sign(PTEID_ByteArray data, boolean signatureKey) throws PTEID_Exception
The PTEID_CMDSignatureClient class only supports signature key. For that reason, signatureKey must be set to true!- Specified by:
Sign
in interfacePTEID_SigningDevice
- Throws:
PTEID_Exception
-
Sign
public PTEID_ByteArray Sign(PTEID_ByteArray data) throws PTEID_Exception
The PTEID_CMDSignatureClient class only supports signature key. For that reason, signatureKey must be set to true!- Specified by:
Sign
in interfacePTEID_SigningDevice
- Throws:
PTEID_Exception
-
SignSHA256
public PTEID_ByteArray SignSHA256(PTEID_ByteArray data, boolean signatureKey) throws PTEID_Exception
Deprecated.Use PTEID_CMDSignatureClient::Sign instead.
The PTEID_CMDSignatureClient class only supports signature key. For that reason, signatureKey must be set to true!- Specified by:
SignSHA256
in interfacePTEID_SigningDevice
- Throws:
PTEID_Exception
-
SignSHA256
public PTEID_ByteArray SignSHA256(PTEID_ByteArray data) throws PTEID_Exception
Deprecated.Use PTEID_CMDSignatureClient::Sign instead.
The PTEID_CMDSignatureClient class only supports signature key. For that reason, signatureKey must be set to true!- Specified by:
SignSHA256
in interfacePTEID_SigningDevice
- 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
- Specified by:
SignXades
in interfacePTEID_SigningDevice
- Throws:
PTEID_Exception
-
SignXades
public PTEID_ByteArray SignXades(java.lang.String output_path, java.lang.String[] paths, long n_paths) throws PTEID_Exception
- Specified by:
SignXades
in interfacePTEID_SigningDevice
- Throws:
PTEID_Exception
-
SignXadesT
public PTEID_ByteArray SignXadesT(java.lang.String output_path, java.lang.String[] paths, long n_paths) throws PTEID_Exception
Warning: This method is not implemented for PTEID_CMDSignatureClient.- Specified by:
SignXadesT
in interfacePTEID_SigningDevice
- Throws:
PTEID_Exception(EIDMW_ERR_NOT_IMPLEMENTED)
- the method is not implemented.PTEID_Exception
-
SignXadesA
public PTEID_ByteArray SignXadesA(java.lang.String output_path, java.lang.String[] paths, long n_paths) throws PTEID_Exception
Warning: This method is not implemented for PTEID_CMDSignatureClient.- Specified by:
SignXadesA
in interfacePTEID_SigningDevice
- Throws:
PTEID_Exception(EIDMW_ERR_NOT_IMPLEMENTED)
- the method is not implemented.PTEID_Exception
-
SignXadesIndividual
public void SignXadesIndividual(java.lang.String output_path, java.lang.String[] paths, long n_paths) throws PTEID_Exception
Warning: This method is not implemented for PTEID_CMDSignatureClient.- Specified by:
SignXadesIndividual
in interfacePTEID_SigningDevice
- Throws:
PTEID_Exception(EIDMW_ERR_NOT_IMPLEMENTED)
- the method is not implemented.PTEID_Exception
-
SignXadesTIndividual
public void SignXadesTIndividual(java.lang.String output_path, java.lang.String[] paths, long n_paths) throws PTEID_Exception
Warning: This method is not implemented for PTEID_CMDSignatureClient.- Specified by:
SignXadesTIndividual
in interfacePTEID_SigningDevice
- Throws:
PTEID_Exception(EIDMW_ERR_NOT_IMPLEMENTED)
- the method is not implemented.PTEID_Exception
-
SignXadesAIndividual
public void SignXadesAIndividual(java.lang.String output_path, java.lang.String[] paths, long n_paths) throws PTEID_Exception
Warning: This method is not implemented for PTEID_CMDSignatureClient.- Specified by:
SignXadesAIndividual
in interfacePTEID_SigningDevice
- Throws:
PTEID_Exception(EIDMW_ERR_NOT_IMPLEMENTED)
- the method is not implemented.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
- Specified by:
SignPDF
in interfacePTEID_SigningDevice
- 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
- Specified by:
SignPDF
in interfacePTEID_SigningDevice
- Throws:
PTEID_Exception
-
getCertificates
public PTEID_Certificates getCertificates() throws PTEID_Exception
This method returns the certificates for the account used in the last signature performed by this client.
If no signature was made, it will open a dialog to introduce the CMD credentials for the account of the certificates to be obtained.- Specified by:
getCertificates
in interfacePTEID_SigningDevice
- Returns:
- an object to access the certificate chain of a CMD account.
Warning: The PTEID_CMDSignatureClient instance manages the allocation and deletion of the PTEID_Certificates returned by getCertificates().
This means that the PTEID_Certificates can only be used while the PTEID_CMDSignatureClient exists (in Java/C# be sure to keep a reference to PTEID_CMDSignatureClient!). - Throws:
PTEID_Exception
-
getCert
public PTEID_Certificate getCert(PTEID_CertifType type) throws PTEID_Exception
- Specified by:
getCert
in interfacePTEID_SigningDevice
- Throws:
PTEID_Exception
-
getRoot
public PTEID_Certificate getRoot() throws PTEID_Exception
- Specified by:
getRoot
in interfacePTEID_SigningDevice
- Throws:
PTEID_Exception
-
getCA
public PTEID_Certificate getCA() throws PTEID_Exception
- Specified by:
getCA
in interfacePTEID_SigningDevice
- Throws:
PTEID_Exception
-
getSignature
public PTEID_Certificate getSignature() throws PTEID_Exception
- Specified by:
getSignature
in interfacePTEID_SigningDevice
- Throws:
PTEID_Exception
-
getAuthentication
public PTEID_Certificate getAuthentication() throws PTEID_Exception
- Specified by:
getAuthentication
in interfacePTEID_SigningDevice
- Throws:
PTEID_Exception
-
getDeviceType
public PTEID_SigningDeviceType getDeviceType()
- Specified by:
getDeviceType
in interfacePTEID_SigningDevice
-
setCredentials
public static void setCredentials(java.lang.String basicAuthUser, java.lang.String basicAuthPassword, java.lang.String applicationId)
Set the credentials for the CMD services.
The credentials must be set once before using the CMD services and will be used for every instance of PTEID_CMDSignatureClient.
-
-