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 voiddelete()PTEID_CertificategetAuthentication()PTEID_CertificategetCA()PTEID_CertificategetCert(PTEID_CertifType type)PTEID_CertificatesgetCertificates()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_SigningDeviceTypegetDeviceType()PTEID_CertificategetRoot()PTEID_CertificategetSignature()longPTEID_SigningDevice_GetInterfaceCPtr()static voidsetCredentials(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.voidsetMobileNumberCaching(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_ByteArraySign(PTEID_ByteArray data)
The PTEID_CMDSignatureClient class only supports signature key.PTEID_ByteArraySign(PTEID_ByteArray data, boolean signatureKey)
The PTEID_CMDSignatureClient class only supports signature key.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)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)PTEID_ByteArraySignSHA256(PTEID_ByteArray data)Deprecated.Use PTEID_CMDSignatureClient::Sign instead.
The PTEID_CMDSignatureClient class only supports signature key.PTEID_ByteArraySignSHA256(PTEID_ByteArray data, boolean signatureKey)Deprecated.Use PTEID_CMDSignatureClient::Sign instead.
The PTEID_CMDSignatureClient class only supports signature key.PTEID_ByteArraySignXades(java.lang.String output_path, java.lang.String[] paths, long n_paths)PTEID_ByteArraySignXades(java.lang.String output_path, java.lang.String[] paths, long n_paths, PTEID_SignatureLevel level)PTEID_ByteArraySignXadesA(java.lang.String output_path, java.lang.String[] paths, long n_paths)Warning: This method is not implemented for PTEID_CMDSignatureClient.voidSignXadesAIndividual(java.lang.String output_path, java.lang.String[] paths, long n_paths)Warning: This method is not implemented for PTEID_CMDSignatureClient.voidSignXadesIndividual(java.lang.String output_path, java.lang.String[] paths, long n_paths)Warning: This method is not implemented for PTEID_CMDSignatureClient.PTEID_ByteArraySignXadesT(java.lang.String output_path, java.lang.String[] paths, long n_paths)Warning: This method is not implemented for PTEID_CMDSignatureClient.voidSignXadesTIndividual(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:
deletein classPTEID_Object
-
PTEID_SigningDevice_GetInterfaceCPtr
public long PTEID_SigningDevice_GetInterfaceCPtr()
- Specified by:
PTEID_SigningDevice_GetInterfaceCPtrin 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:
Signin 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:
Signin 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:
SignSHA256in 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:
SignSHA256in 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:
SignXadesin 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:
SignXadesin 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:
SignXadesTin 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:
SignXadesAin 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_ExceptionWarning: This method is not implemented for PTEID_CMDSignatureClient.- Specified by:
SignXadesIndividualin 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_ExceptionWarning: This method is not implemented for PTEID_CMDSignatureClient.- Specified by:
SignXadesTIndividualin 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_ExceptionWarning: This method is not implemented for PTEID_CMDSignatureClient.- Specified by:
SignXadesAIndividualin 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:
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
- Specified by:
SignPDFin 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:
SignPDFin 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:
getCertificatesin 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:
getCertin interfacePTEID_SigningDevice- Throws:
PTEID_Exception
-
getRoot
public PTEID_Certificate getRoot() throws PTEID_Exception
- Specified by:
getRootin interfacePTEID_SigningDevice- Throws:
PTEID_Exception
-
getCA
public PTEID_Certificate getCA() throws PTEID_Exception
- Specified by:
getCAin interfacePTEID_SigningDevice- Throws:
PTEID_Exception
-
getSignature
public PTEID_Certificate getSignature() throws PTEID_Exception
- Specified by:
getSignaturein interfacePTEID_SigningDevice- Throws:
PTEID_Exception
-
getAuthentication
public PTEID_Certificate getAuthentication() throws PTEID_Exception
- Specified by:
getAuthenticationin interfacePTEID_SigningDevice- Throws:
PTEID_Exception
-
getDeviceType
public PTEID_SigningDeviceType getDeviceType()
- Specified by:
getDeviceTypein 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.
-
-