![]() |
|
SignDoc SDK (.NET with exceptions)
5.0.2.22
|
An X.509 certificiate. More...
Public Member Functions | |
| ~SignDocCertificate () | |
| Destructor. More... | |
| !SignDocCertificate () | |
| Finalizer. More... | |
| SignDocCertificate () | |
| Constructor. More... | |
| SignDocCertificate (SignDocCertificate aSource) | |
| Copy constructor. More... | |
| SignDocCertificate | clone () |
| Create a copy of this object. More... | |
| void | clear () |
| Remove any certificates from this object. More... | |
| void | loadFromMemory (ConstArray(Byte) aData, CertificateLoadFlags aFlags) |
| Load a certificate from a blob. More... | |
| void | loadFromFile (string aPath, CertificateLoadFlags aFlags) |
| Load a certificate from a file. More... | |
| int | getCertificateCount () |
| Get the number of certificates. More... | |
| void | selectCertificate (int aIndex) |
| Select a certificate. More... | |
| int | getSelectedCertificate () |
| Get the index of the currently selected certificate. More... | |
| ARRAY (Byte) saveToMemory(CertificateSaveFlags aFlags) | |
| Save the selected certificate as a blob. More... | |
| void | saveToFile (string aPath, CertificateSaveFlags aFlags) |
| Save the certificate to a file. More... | |
| string | getLabel () |
| Get the PEM label of the certificate. More... | |
| bool | isCA () |
| Check if the CA bit of the certificate is set. More... | |
| bool | isSelfSigned () |
| Check if the certificate is self-signed. More... | |
| bool | isValidForSigning (SignDocSignatureParameters aParameters) |
| Check if the certificate can be used as signing certificate for signing documents. More... | |
| string | getIssuerCommonName () |
| Get the issuer common name. More... | |
| string | getSubjectCommonName () |
| Get the subject common name. More... | |
| string | getSubjectEmail () |
| Get the subject's email address. More... | |
| string | getNotBefore () |
| Get the notBefore value. More... | |
| string | getNotAfter () |
| Get the notAfter value. More... | |
| string | getKeyAlgorithm () |
| Get the key algorithm in human-readable form. More... | |
| string | getKeyAlgorithmOID () |
| Get the key algorithm as object identifier. More... | |
| ARRAY (Byte) getSerialNumber() | |
| Get the serial number. More... | |
| ARRAY (Byte) getEncodedIssuer() | |
| Get the encoded issuer. More... | |
| ARRAY (Byte) getEncodedSubject() | |
| Get the encoded subject. More... | |
| ARRAY (SignDocCertificate) getSigningCertificates(SignDocSignatureParameters aParameters) | |
| Get certificates that can be used for signing. More... | |
| string | getErrorMessage () |
| Get an error message for the last function call. More... | |
An X.509 certificiate.
This class can be used for extracting information from an X.509 certificate. You can also use getSigningCertificates() to get certificates that can be used for signing.
When loading from a PEM blob or file (or when using CertificateLoadFlags.Add), an object of this class may contain multiple certificates, see getCertificateCount() and selectCertificate().
| ~SignDocCertificate | ( | ) |
Destructor.
| !SignDocCertificate | ( | ) |
Finalizer.
Constructor.
This object won't contain a certificate for now, getCertificateCount() will return zero.
| SignDocCertificate | ( | SignDocCertificate | aSource | ) |
Copy constructor.
| [in] | aSource | The object to be copied. |
| ARRAY | ( | Byte | ) |
Save the selected certificate as a blob.
If all certificates are selected by selectCertificate(-1), aFlags must include CertificateSaveFlags.PEM.
Certificates without PEM label will be saved with PEM label "CERTIFICATE".
| [in] | aFlags | Flags controlling the format of the blob and other details of the operation, see CertificateSaveFlags. |
| ARRAY | ( | Byte | ) |
Get the serial number.
| ARRAY | ( | Byte | ) |
Get the encoded issuer.
| ARRAY | ( | Byte | ) |
Get the encoded subject.
| ARRAY | ( | SignDocCertificate | ) |
Get certificates that can be used for signing.
On Windows, the certificates are provided by the Windows certificate store or a PKCS #11 module configured in aParameters.
On MacOS and Linux, the certificates are provided by a PKCS #11 module configured in aParameters.
Only certificates for which a private key is available and which are time-valid and have suitable key usage will be returned.
This SignDocCertificate object is only used for storing any error message.
| [in] | aParameters | PKCS #11 configuration and parameters for filtering certificates. Integer parameter "SelectCertificate" must include CertificateSelectionFlags.Software or CertificateSelectionFlags.Hardware. Values from the signature field's seed value dictionary stored in aParameters by SignDocDocument.createSignatureParameters() will be used for filtering certificates. String parameter "Timestamp" (which must not be "TSA") and integer parameter "TimestampOffset" will be used for getting the signing time. |
| void clear | ( | ) |
Remove any certificates from this object.
getCertificateCount() will return zero.
| SignDocCertificate clone | ( | ) |
Create a copy of this object.
| int getCertificateCount | ( | ) |
Get the number of certificates.
After loading from a PEM blob or file, this object may contain multiple certificates. This method returns the number of certificates loaded.
| string getErrorMessage | ( | ) |
Get an error message for the last function call.
| string getIssuerCommonName | ( | ) |
Get the issuer common name.
| string getKeyAlgorithm | ( | ) |
Get the key algorithm in human-readable form.
| string getKeyAlgorithmOID | ( | ) |
Get the key algorithm as object identifier.
| string getLabel | ( | ) |
Get the PEM label of the certificate.
| string getNotAfter | ( | ) |
Get the notAfter value.
The certificate is not valid after the time specified by the notAfter value.
| string getNotBefore | ( | ) |
Get the notBefore value.
The certificate is not valid before the time specified by the notBefore value.
| int getSelectedCertificate | ( | ) |
Get the index of the currently selected certificate.
| string getSubjectCommonName | ( | ) |
Get the subject common name.
| string getSubjectEmail | ( | ) |
Get the subject's email address.
| bool isCA | ( | ) |
Check if the CA bit of the certificate is set.
| bool isSelfSigned | ( | ) |
Check if the certificate is self-signed.
| bool isValidForSigning | ( | SignDocSignatureParameters | aParameters | ) |
Check if the certificate can be used as signing certificate for signing documents.
| [in] | aParameters | Parameters for getting the signing time, can be null. Only string parameter "Timestamp" (which must not be "TSA") and integer parameter "TimestampOffset" are used. |
| void loadFromFile | ( | string | aPath, |
| CertificateLoadFlags | aFlags | ||
| ) |
Load a certificate from a file.
For PEM, multiple certificates may be loaded.
This method opens the file, loads the certificate from the file, and closes the file.
The first new certificate will be selected.
| [in] | aPath | The pathname of the file to be read. |
| [in] | aFlags | Flags modifying the behavior of this function, see CertificateLoadFlags. |
getCertificateCount(), loadFromMemory(), saveToFile(), selectCertificate()
| void loadFromMemory | ( | ConstArray(Byte) | aData, |
| CertificateLoadFlags | aFlags | ||
| ) |
Load a certificate from a blob.
For PEM, multiple certificates may be loaded.
The first new certificate will be selected.
| [in] | aBlob | A blob containing a DER-encoded or PEM-encoded X.509 certificate. |
| [in] | aFlags | Flags modifying the behavior of this function, see CertificateLoadFlags. |
| void saveToFile | ( | string | aPath, |
| CertificateSaveFlags | aFlags | ||
| ) |
Save the certificate to a file.
If all certificates are selected by selectCertificate(-1), aFlags must include SaveCertificateFlags.PEM.
Certificates without PEM label will be saved with PEM label "CERTIFICATE".
| [in] | aPath | The pathname of the file to be created or overwritten. |
| [in] | aFlags | Flags controlling the format of the blob and other details of the operation, see CertificateSaveFlags. |
| void selectCertificate | ( | int | aIndex | ) |
Select a certificate.
After loading from a PEM blob or file, this object may contain multiple certificates. This method selects the certificate to be operated on. Initially, the first certificate (at index 0) is selected.
Methods such as getSubjectCommonName() that work on a single certificate will fail if all certificates are selected even if there is only one certificate.
| [in] | aIndex | 0-based index of the certificate to be selected, -1 to select all certificates. |