Portuguese eID Middleware SDK  Version: 3.12.0
eIDMW::PTEID_SigningDevice Class Referenceabstract

#include <eidlib.h>

Public Member Functions

virtual PTEIDSDK_API PTEID_ByteArray Sign (const PTEID_ByteArray &data, bool signatureKey=false)=0
 
virtual PTEIDSDK_API PTEID_ByteArray SignSHA256 (const PTEID_ByteArray &data, bool signatureKey=false)=0
 
virtual PTEIDSDK_API PTEID_ByteArray SignXades (const char *output_path, const char *const *paths, unsigned int n_paths, PTEID_SignatureLevel level=PTEID_LEVEL_BASIC)=0
 
virtual PTEIDSDK_API PTEID_ByteArray SignXadesT (const char *output_path, const char *const *paths, unsigned int n_paths)=0
 
virtual PTEIDSDK_API PTEID_ByteArray SignXadesA (const char *output_path, const char *const *paths, unsigned int n_paths)=0
 
virtual PTEIDSDK_API void SignXadesIndividual (const char *output_path, const char *const *paths, unsigned int n_paths)=0
 
virtual PTEIDSDK_API void SignXadesTIndividual (const char *output_path, const char *const *paths, unsigned int n_paths)=0
 
virtual PTEIDSDK_API void SignXadesAIndividual (const char *output_path, const char *const *paths, unsigned int n_paths)=0
 
virtual PTEIDSDK_API int SignPDF (PTEID_PDFSignature &sig_handler, int page, int page_sector, bool is_landscape, const char *location, const char *reason, const char *outfile_path)=0
 
virtual PTEIDSDK_API int SignPDF (PTEID_PDFSignature &sig_handler, int page, double coord_x, double coord_y, const char *location, const char *reason, const char *outfile_path)=0
 
virtual PTEIDSDK_API PTEID_CertificatesgetCertificates ()=0
 
virtual PTEIDSDK_API PTEID_CertificategetCert (PTEID_CertifType type)=0
 
virtual PTEIDSDK_API PTEID_CertificategetRoot ()=0
 
virtual PTEIDSDK_API PTEID_CertificategetCA ()=0
 
virtual PTEIDSDK_API PTEID_CertificategetSignature ()=0
 
virtual PTEIDSDK_API PTEID_CertificategetAuthentication ()=0
 
virtual PTEIDSDK_API PTEID_SigningDeviceType getDeviceType ()=0
 

Detailed Description

Interface class for objects with Signing capabilities.

Since
3.8.0

Member Function Documentation

◆ getAuthentication()

virtual PTEIDSDK_API PTEID_Certificate& eIDMW::PTEID_SigningDevice::getAuthentication ( )
pure virtual
Deprecated:
Use getCertificates() to obtain the certificates and obtain the desired certificate/build the chain manually.

Implemented in eIDMW::PTEID_CMDSignatureClient, and eIDMW::PTEID_Card.

◆ getCA()

virtual PTEIDSDK_API PTEID_Certificate& eIDMW::PTEID_SigningDevice::getCA ( )
pure virtual
Deprecated:
Use getCertificates() to obtain the certificates and obtain the desired certificate/build the chain manually.

Implemented in eIDMW::PTEID_CMDSignatureClient, and eIDMW::PTEID_Card.

◆ getCert()

virtual PTEIDSDK_API PTEID_Certificate& eIDMW::PTEID_SigningDevice::getCert ( PTEID_CertifType  type)
pure virtual
Deprecated:
Use getCertificates() to obtain the certificates and obtain the desired certificate/build the chain manually.

Implemented in eIDMW::PTEID_CMDSignatureClient, and eIDMW::PTEID_Card.

◆ getCertificates()

virtual PTEIDSDK_API PTEID_Certificates& eIDMW::PTEID_SigningDevice::getCertificates ( )
pure virtual
Deprecated:
Use getCertificates() to obtain the certificates and obtain the desired certificate/build the chain manually.

Implemented in eIDMW::PTEID_CMDSignatureClient, and eIDMW::PTEID_Card.

◆ getDeviceType()

virtual PTEIDSDK_API PTEID_SigningDeviceType eIDMW::PTEID_SigningDevice::getDeviceType ( )
pure virtual

Get type of SigningDeviceType.

Implemented in eIDMW::PTEID_CMDSignatureClient, and eIDMW::PTEID_Card.

◆ getRoot()

virtual PTEIDSDK_API PTEID_Certificate& eIDMW::PTEID_SigningDevice::getRoot ( )
pure virtual
Deprecated:
Use getCertificates() to obtain the certificates and obtain the desired certificate/build the chain manually.

Implemented in eIDMW::PTEID_CMDSignatureClient, and eIDMW::PTEID_Card.

◆ getSignature()

virtual PTEIDSDK_API PTEID_Certificate& eIDMW::PTEID_SigningDevice::getSignature ( )
pure virtual
Deprecated:
Use getCertificates() to obtain the certificates and obtain the desired certificate/build the chain manually.

Implemented in eIDMW::PTEID_CMDSignatureClient, and eIDMW::PTEID_Card.

◆ Sign()

virtual PTEIDSDK_API PTEID_ByteArray eIDMW::PTEID_SigningDevice::Sign ( const PTEID_ByteArray data,
bool  signatureKey = false 
)
pure virtual

Raw RSA signature with PCKS #1 padding.

Parameters
dataholds the data to be signed, at most 32 bytes. This data should be hashed using sha256.
signatureKeywhether 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.

Implemented in eIDMW::PTEID_CMDSignatureClient, and eIDMW::PTEID_Card.

◆ SignPDF() [1/2]

virtual PTEIDSDK_API int eIDMW::PTEID_SigningDevice::SignPDF ( PTEID_PDFSignature sig_handler,
int  page,
int  page_sector,
bool  is_landscape,
const char *  location,
const char *  reason,
const char *  outfile_path 
)
pure virtual

PDF 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.

Parameters
sig_handlerthis defines the input file and some signature options
pagein case of visible signature it defines the page where the signature will appear
page_sectorposition in the signature grid, between 1 to 18 for Portrait documents and 1 to 20 for Landscape ones
is_landscapeis unused parameter, the SDK now detects document orientation automatically
locationSignature metadata field
reasonSignature metadata field
outfile_pathNative Filesystem path of the ouput file
Deprecated:
use the SignPDF function with location coordinates instead

Implemented in eIDMW::PTEID_CMDSignatureClient, and eIDMW::PTEID_Card.

◆ SignPDF() [2/2]

virtual PTEIDSDK_API int eIDMW::PTEID_SigningDevice::SignPDF ( PTEID_PDFSignature sig_handler,
int  page,
double  coord_x,
double  coord_y,
const char *  location,
const char *  reason,
const char *  outfile_path 
)
pure virtual

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.

Parameters
sig_handlerthis defines the input file and some signature options
pagein case of visible signature it defines the page where the signature will appear
coord_xX coordinate of the signature location (percentage of page width)
coord_yY coordinate of the signature location (percentage of page height)
locationLocation field in the added signature metadata
reasonSignature metadata field
outfile_pathNative Filesystem path of the ouput file

Implemented in eIDMW::PTEID_CMDSignatureClient, and eIDMW::PTEID_Card.

◆ SignSHA256()

virtual PTEIDSDK_API PTEID_ByteArray eIDMW::PTEID_SigningDevice::SignSHA256 ( const PTEID_ByteArray data,
bool  signatureKey = false 
)
pure virtual

Raw RSA signature with PCKS #1 padding (applied to a SHA256 hash).

Parameters
dataholds the data to be signed, it should be 32 bytes.
signatureKeywhether 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.
Deprecated:
This method is now deprecated. Use PTEID_SigningDevice::Sign method instead, which already supports SHA256.

Implemented in eIDMW::PTEID_CMDSignatureClient, and eIDMW::PTEID_Card.

◆ SignXades()

virtual PTEIDSDK_API PTEID_ByteArray eIDMW::PTEID_SigningDevice::SignXades ( const char *  output_path,
const char *const *  paths,
unsigned int  n_paths,
PTEID_SignatureLevel  level = PTEID_LEVEL_BASIC 
)
pure virtual

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.

Parameters
pathsis 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 signature
n_pathsis the number of elements in the paths array
output_pathpoints to the resulting container
levelis 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.

Implemented in eIDMW::PTEID_CMDSignatureClient, and eIDMW::PTEID_Card.

◆ SignXadesA()

virtual PTEIDSDK_API PTEID_ByteArray eIDMW::PTEID_SigningDevice::SignXadesA ( const char *  output_path,
const char *const *  paths,
unsigned int  n_paths 
)
pure virtual

Produce 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.

Parameters
pathsis 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 signature
n_pathsis the number of elements in the paths array
output_pathpoints to the resulting container
Deprecated:
use the SignXades function and set signature level with level (PTEID_SignatureLevel) parameter instead

Implemented in eIDMW::PTEID_CMDSignatureClient, and eIDMW::PTEID_Card.

◆ SignXadesAIndividual()

virtual PTEIDSDK_API void eIDMW::PTEID_SigningDevice::SignXadesAIndividual ( const char *  output_path,
const char *const *  paths,
unsigned int  n_paths 
)
pure virtual

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.

Parameters
pathsis 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 signature
n_pathsis the number of elements in the paths array
output_pathdirectory of the created ASiC containers

Implemented in eIDMW::PTEID_CMDSignatureClient, and eIDMW::PTEID_Card.

◆ SignXadesIndividual()

virtual PTEIDSDK_API void eIDMW::PTEID_SigningDevice::SignXadesIndividual ( const char *  output_path,
const char *const *  paths,
unsigned int  n_paths 
)
pure virtual

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.

Parameters
pathsis 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 signature
n_pathsis the number of elements in the paths array
output_pathdirectory of the created ASiC containers

Implemented in eIDMW::PTEID_CMDSignatureClient, and eIDMW::PTEID_Card.

◆ SignXadesT()

virtual PTEIDSDK_API PTEID_ByteArray eIDMW::PTEID_SigningDevice::SignXadesT ( const char *  output_path,
const char *const *  paths,
unsigned int  n_paths 
)
pure virtual

Produce 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.

Parameters
pathsis 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 signature
n_pathsis the number of elements in the paths array
output_pathpoints to the resulting container
Deprecated:
use the SignXades function and set signature level with level (PTEID_SignatureLevel) parameter instead

Implemented in eIDMW::PTEID_CMDSignatureClient, and eIDMW::PTEID_Card.

◆ SignXadesTIndividual()

virtual PTEIDSDK_API void eIDMW::PTEID_SigningDevice::SignXadesTIndividual ( const char *  output_path,
const char *const *  paths,
unsigned int  n_paths 
)
pure virtual

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.

Parameters
pathsis 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 signature
n_pathsis the number of elements in the paths array
output_pathdirectory of the created ASiC containers

Implemented in eIDMW::PTEID_CMDSignatureClient, and eIDMW::PTEID_Card.