public class PrivateKeySignature extends java.lang.Object implements ExternalSignature
Constructor and Description |
---|
PrivateKeySignature(java.security.PrivateKey pk,
java.lang.String hashAlgorithm,
java.lang.String provider)
Creates an ExternalSignature instance
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getEncryptionAlgorithm()
Returns the encryption algorithm used for signing.
|
java.lang.String |
getHashAlgorithm()
Returns the hash algorithm.
|
byte[] |
sign(byte[] b)
Signs it using the encryption algorithm in combination with
the digest algorithm.
|
public PrivateKeySignature(java.security.PrivateKey pk, java.lang.String hashAlgorithm, java.lang.String provider)
pk
- a PrivateKey objecthashAlgorithm
- the hash algorithm (e.g. "SHA-1", "SHA-256",...)provider
- the security provider (e.g. "BC")public java.lang.String getHashAlgorithm()
getHashAlgorithm
in interface ExternalSignature
ExternalSignature.getHashAlgorithm()
public java.lang.String getEncryptionAlgorithm()
getEncryptionAlgorithm
in interface ExternalSignature
ExternalSignature.getEncryptionAlgorithm()
public byte[] sign(byte[] b) throws java.security.GeneralSecurityException
sign
in interface ExternalSignature
message
- the message you want to be hashed and signedjava.security.GeneralSecurityException
Copyright © 2013. All Rights Reserved.