PSPDFPKCS12Signer
Objective-C
@interface PSPDFPKCS12Signer : PSPDFSigner
Swift
class PKCS12Signer : PDFSigner
Concrete implementation of a PSPDFSigner
.
This class augments the functionality of its superclass by supporting password-protected PKCS12 files (.p12 extension).
-
Unavailable
Not the designated initializer
Undocumented
Declaration
Objective-C
PSPDF_EMPTY_INIT_UNAVAILABLE
-
Unavailable
Not the designated initializer
Undocumented
Declaration
Objective-C
PSPDF_EMPTY_INIT_UNAVAILABLE
-
Creates a new PKCS12 signer with the specified display name. The certificate and private key should be contained in the
PSPDFPKCS12
instance.Declaration
Objective-C
- (nonnull instancetype)initWithDisplayName:(nonnull NSString *)displayName PKCS12:(nonnull PSPDFPKCS12 *)p12;
Swift
init(displayName: String, pkcs12 p12: PKCS12)
-
The PKCS12 container holding the private key and certificate.
Declaration
Objective-C
@property (nonatomic, readonly) PSPDFPKCS12 *_Nonnull p12;
Swift
var p12: PKCS12 { get }
-
Signs the passed form element |elem| using provided password to open the p12 container (to get the certificate and the private key) and writes the signed document to |path|. Returns YES for |success|, NO otherwise and error |err| is set.
Declaration
Objective-C
- (void)signFormElement:(nonnull PSPDFSignatureFormElement *)element usingPassword:(nonnull NSString *)password writeTo:(nonnull NSString *)path completion:(nullable void (^)(BOOL, PSPDFDocument *_Nonnull, NSError *_Nullable))completionBlock;
Swift
func sign(_ element: SignatureFormElement, usingPassword password: String, writeTo path: String, completion completionBlock: ((Bool, Document, Error?) -> Void)? = nil)
Parameters
element
The signature form element to sign.
password
The password to unlock the p12 container.
path
The destination path for the signed document.
-
Signs the passed form element |elem| using provided password to open the p12 container (to get the certificate and the private key) and writes the signed document to |path|. Returns YES for |success|, NO otherwise and error |err| is set.
Declaration
Objective-C
- (void)signFormElement:(nonnull PSPDFSignatureFormElement *)element usingPassword:(nonnull NSString *)password writeTo:(nonnull NSString *)path appearance:(nullable PSPDFSignatureAppearance *)signatureAppearance biometricProperties: (nullable PSPDFSignatureBiometricProperties *)biometricProperties completion:(nullable void (^)(BOOL, PSPDFDocument *_Nonnull, NSError *_Nullable))completionBlock;
Swift
func sign(_ element: SignatureFormElement, usingPassword password: String, writeTo path: String, appearance signatureAppearance: PSPDFSignatureAppearance?, biometricProperties: PDFSignatureBiometricProperties?, completion completionBlock: ((Bool, Document, Error?) -> Void)? = nil)
Parameters
element
The signature form element to sign.
password
The password to unlock the p12 container.
path
The destination path for the signed document.
signatureAppearance
The
PSPDFSignatureAppearance
instance that customizes how the signature will appear in the signed document. Ifnil
, the default signature appearance will be used.biometricProperties
The
PSPDFSignatureBiometricProperties
instance that adds enhanced security properties to the signature, like input pressure, type, etc. -
Signs the passed form element |element| and writes the signed document to |dataSink|. The completion block will signal if the result was successful, return the signed document, if it was signed correctly, and the signing error, if there’s any.
Declaration
Objective-C
- (void)signFormElement:(nonnull PSPDFSignatureFormElement *)element usingPassword:(nonnull NSString *)password writeToDataSink:(nonnull id<PSPDFDataSink>)dataSink completionBlock:(nullable void (^)(BOOL, id<PSPDFDataSink> _Nullable, NSError *_Nullable))completionBlock;
Swift
func sign(_ element: SignatureFormElement, usingPassword password: String, writeTo dataSink: DataSink, completionBlock: ((Bool, DataSink?, Error?) -> Void)? = nil)
Parameters
element
The signature form element to sign.
password
The password to unlock the p12 container.
dataSink
The destination data sink for the signed document. - see:
PSPDFDataSink
. -
Signs the passed form element |element| and writes the signed document to |path|. The completion block will signal if the result was successful, return the signed document, if it was signed correctly, and the signing error, if there’s any.
Declaration
Objective-C
- (void)signFormElement:(nonnull PSPDFSignatureFormElement *)element usingPassword:(nonnull NSString *)password writeTo:(nonnull NSString *)path completionBlock:(nullable void (^)(BOOL, PSPDFDocument *_Nullable, NSError *_Nullable))completionBlock;
Swift
func sign(_ element: SignatureFormElement, usingPassword password: String, writeTo path: String, completionBlock: ((Bool, Document?, Error?) -> Void)? = nil)
Parameters
element
The signature form element to sign.
password
The password to unlock the p12 container.
path
The destination path for the signed document.