The STCertificateManager class is responsible for managing certificates and private keys that are used for digitally signing documents and encrypting biometric data. It is implemented as a singleton and is part of the libSignoPDFSigner.
The class declaration is as follows:
@interface STCertificateManager: NSObject
The instantiation of the STCertificateManager class is not possible by means of init methods; the static method +[STCertificateManager getCertificateManager:] must be used.
getCertificateManager method
There is only one instance of the STCertificateManager class (singleton instance), which can be accessed using this static method.
+(STLicenceManager*)getLicenceManager
|
Parameter |
Description |
|---|---|
|
- |
- |
|
Return value |
Description |
|
STCertificateManager* |
The singleton instance of the STCertificateManager class. |
Usage:
STCertificateManager *certManager = [STCertificateManager getCertificateManager];
setCertificates:withSigningPrivateKey:biometricX509Certificate: method
This method makes it possible to set an X.509 signature certificate with an associated private key and a biometric certificate.
-(int)setCertificates:(NSData*)signingX509Certificate withSigningPrivateKey:(NSData*)signingPrivateKey biometricX509Certificate:(NSData*)biometricX509Certificate
|
Parameter |
Description |
|
|---|---|---|
|
(NSData*) signingX509Certificate |
The public certificate as a byte array, for the verification of the signature on the document. This is ignored if nil is transferred for signingPrivateKey. |
|
|
(NSData*) signingPrivateKey |
The private key for signing the document, as a byte array. If nil is transferred, the signature must be calculated outside of the API. See also -[STSignoInfoDelegate computeDigitalSignature:completion:]. |
|
|
(NSData*) biometricX509Certificate |
X.509 certificate as a byte array, with the public key for encrypting the biometrics. |
|
|
Return value |
Description |
|
|
int |
0 |
Method was executed successfully. |
|
|
< 0 |
An error occurred (see above). |
Usage:
int ret = [certManager setCertificates:signingX509Certificate withSigningPrivateKey:signingPrivateKey biometricX509Certificate: biometricX509Certificate];
if (ret < 0) {
//error handling
}
setCertificates:withPKCS12Password:biometricX509Certificate: method
This method can be used to set a PKCS#12 signature certificate and a biometric certificate.
-(int)setCertificates:(NSData*)signingPKCS12Certificate withPKC12Password:(NSString*)pkcs12Password biometricX509Certificate:(NSData*)biometricX509Certificate
|
Parameter |
Description |
|
|---|---|---|
|
(NSData*) signingPKCS12Certificate |
PKCS#12 file as a byte array, with the private key and the public certificate for signing the document. If nil is transferred, the signature must be calculated outside of the API. See also -[STSignoInfoDelegate computeDigitalSignature:completion:]. |
|
|
(NSString*) pkcs12Password |
Password for PKCS#12 file. This is ignored if nil is transferred for signingPKCS12Certificate. |
|
|
(NSData*) biometricX509Certificate |
X.509 certificate as a byte array, with the public key for encrypting the biometrics. |
|
|
Return value |
Description |
|
|
int |
0 |
Method was executed successfully. |
|
|
< 0 |
An error occurred (see above). |
Usage:
int ret = [certManager setCertificates: signingPKCS12Certificate withPKC12Password: pkcs12Password biometricCertificate: biometricX509Certificate];
if (ret < 0) {
//error handling
}
setPKCS12SigningCertificate:withPassword: method
This method sets a PKCS#12 signature certificate with the corresponding password.
-(int)setPKCS12SigningCertificate:(NSData*)signingPKCS12Certificate withPassword:(NSString*)password
|
Parameter |
Description |
|
|---|---|---|
|
(NSData*) signingPKCS12Certificate |
PKCS#12 file as a byte array, with the private key and the public certificate for signing the document. If nil is transferred, the signature must be calculated outside of the API. See also -[STSignoInfoDelegate computeDigitalSignature:completion:]. |
|
|
(NSString*)password |
Password for PKCS#12 file. This is ignored if nil is transferred for signingPKCS12Certificate. |
|
|
Return value |
Description |
|
|
int |
0 |
Method was executed successfully. |
|
|
< 0 |
An error occurred (see above). |
Usage:
int ret = [certManager setPKCS12SigningCertificate: signingPKCS12Certificate withPassword:password];
if (ret < 0) {
//error handling
}
setX509SigningCertificate:withSigningPrivateKey: method
This method sets an X.509 signing certificate together with the private key.
-(int)setX509SigningCertificate:(NSData*)signingX509Certificate withSigningPrivateKey:(NSData*)signingPrivateKey
|
Parameter |
Description |
|
|---|---|---|
|
(NSData*) signingX509Certificate |
The public certificate as a byte array, for the verification of the signature on the document. This is ignored if nil is transferred for signingPrivateKey. |
|
|
(NSData*) signingPrivateKey |
The private key for signing the document, as a byte array. If nil is transferred, the signature must be calculated outside of the API. See also -[STSignoInfoDelegate computeDigitalSignature:completion:]. |
|
|
Return value |
Description |
|
|
int |
0 |
Method was executed successfully. |
|
|
< 0 |
An error occurred (see above). |
Usage:
int ret = [certManager setX509SigningCertificate: signingX509Certificate withSigningPrivateKey:signingPrivateKey];
if (ret < 0) {
//error handling
}
setX509BiometricCertificate: method
This method uses the X.509 certificate to encrypt biometric data.
-(int)setX509BiometricCertificate:(NSData*)biometricX509Certificate
|
Parameter |
Description |
|
|---|---|---|
|
(NSData*) biometricX509Certificate |
X.509 certificate as a byte array, with the public key for encrypting the biometrics. |
|
|
Return value |
Description |
|
|
int |
0 |
Method was executed successfully. |
|
|
< 0 |
An error occurred (see above). |
Usage:
int ret = [certManager setX509BiometricCertificate: biometricX509Certificate];
if (ret < 0) {
//error handling
}
hasSigningCertificate method
This method can be used to check whether a certificate and the corresponding private key for signing the document have been provided using one of the following methods: setX509SigningCertificate:withSigningPrivateKey:, setPKCS12SigningCertificate:withPassword:, setCertificates:withPKCS12Password:biometricX509Certificate: or setCertificates:withSigningPrivateKey:biometricX509Certificate:.
-(BOOL)hasSigningCertificate
|
Parameter |
Description |
|
|---|---|---|
|
- |
- |
|
|
Return value |
Description |
|
|
BOOL |
YES |
The certificate and the corresponding private key for signing the document are available. |
|
|
NO |
The certificate and the corresponding private key for signing the document are not available. |
Usage:
BOOL hasSigningCertificate = [certManager hasSigningCertificate];
hasBiometricCertificate method
This method can be used to check whether a certificate for encrypting biometric data has been provided using one of the following methods: setCertificates:withPKCS12Password:biometricX509Certificate:, setCertificates:withSigningPrivateKey:biometricX509Certificate: or setX509BiometricCertificate:.
-(BOOL)hasBiometricCertificate
|
Parameter |
Description |
|
|---|---|---|
|
- |
- |
|
|
Return value |
Description |
|
|
BOOL |
YES |
The certificate for encrypting biometric data is available. |
|
|
NO |
The certificate for encrypting biometric data is not available. |
Usage:
BOOL hasBiometricCertificate = [certManager hasBiometricCertificate];