public class PrivateKeySignature extends Object implements ExternalSignature
Constructor and Description |
---|
PrivateKeySignature(PrivateKey pk, String hashAlgorithm, String provider)
Creates an ExternalSignature 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[] b)
Signs it using the encryption algorithm in combination with the digest algorithm.
|
public PrivateKeySignature(PrivateKey pk, String hashAlgorithm, String provider)
pk
- a PrivateKey object
hashAlgorithm
- the hash algorithm (e.g. "SHA-1", "SHA-256",...)
provider
- the security provider (e.g. "BC")
public String getHashAlgorithm()
getHashAlgorithm
in interface ExternalSignature
ExternalSignature.getHashAlgorithm()
public String getEncryptionAlgorithm()
getEncryptionAlgorithm
in interface ExternalSignature
ExternalSignature.getEncryptionAlgorithm()
public byte[] sign(byte[] b) throws GeneralSecurityException
sign
in interface ExternalSignature
message
- the message you want to be hashed and signed
GeneralSecurityException
Copyright © 1998–2022. All rights reserved.