public class

PrivateKeySignatureProvider

extends Object
implements SignatureProvider
java.lang.Object
   ↳ com.pspdfkit.signatures.provider.PrivateKeySignatureProvider

Class Overview

Signature provider using a KeyStore.PrivateKeyEntry to sign document data. The used private key has to be in either PKCS#8 or PKCS#1 format, or this class will throw an exception while instantiation.

Summary

Public Constructors
PrivateKeySignatureProvider(KeyStore.PrivateKeyEntry privateKey)
Create the signature provider using the given privateKey.
Public Methods
EncryptionAlgorithm getEncryptionAlgorithm()
Returns the encryption algorithm used by this signature provider.
byte[] signData(byte[] data, HashAlgorithm hashAlgorithm)
Returns a hash from signing the given data.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.pspdfkit.signatures.provider.SignatureProvider

Public Constructors

public PrivateKeySignatureProvider (KeyStore.PrivateKeyEntry privateKey)

Create the signature provider using the given privateKey. If the key is not in PKCS#8 or PKCS#1 format or decoding of the key fails, this method will throw a CertificateEncodingException.

Parameters
privateKey A private key entry in PKCS#8 or PKCS#1 format.
Throws
CertificateEncodingException Thrown if the given private key is in the wrong format or could not be decoded.

Public Methods

public EncryptionAlgorithm getEncryptionAlgorithm ()

Returns the encryption algorithm used by this signature provider.

Returns

public byte[] signData (byte[] data, HashAlgorithm hashAlgorithm)

Returns a hash from signing the given data.

Parameters
data Data that should be hashed and signed.
hashAlgorithm Hash algorithm that should be applied to data before signing it.
Returns
  • Signed hash.