public class PrivateKeySignature extends Object implements IExternalSignature
IExternalSignature interface that can be used when you have a PrivateKey object.
| Constructor and Description |
|---|
PrivateKeySignature(PrivateKey pk, String hashAlgorithm, String provider)
Creates a PrivateKeySignature instance.
|
| Modifier and Type | Method and Description |
|---|---|
String |
getEncryptionAlgorithm()
Returns the encryption algorithm used for signing.
|
String |
getHashAlgorithm()
Returns the hash algorithm.
|
byte[] |
sign(byte[] message)
Signs the given message using the encryption algorithm in combination with the hash algorithm.
|
public PrivateKeySignature(PrivateKey pk, String hashAlgorithm, String provider)
PrivateKeySignature instance.
pk - A PrivateKey object.
hashAlgorithm - A hash algorithm (e.g. "SHA-1", "SHA-256",...).
provider - A security provider (e.g. "BC").
public String getHashAlgorithm()
getHashAlgorithm in interface IExternalSignature
public String getEncryptionAlgorithm()
getEncryptionAlgorithm in interface IExternalSignature
public byte[] sign(byte[] message)
throws GeneralSecurityException
sign in interface IExternalSignature
message - The message you want to be hashed and signed.
GeneralSecurityException
Copyright © 1998–2017 iText Group NV. All rights reserved.