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. |
PrivateKeySignature(PrivateKey pk,
String hashAlgorithm,
String signatureAlgorithm,
String provider,
IApplicableSignatureParams params)
Creates a
PrivateKeySignature instance. |
| Modifier and Type | Method and Description |
|---|---|
String |
getDigestAlgorithmName()
Returns the digest algorithm.
|
String |
getSignatureAlgorithmName()
Returns the signature algorithm used for signing, disregarding the digest function.
|
ISignatureMechanismParams |
getSignatureMechanismParameters()
Return the algorithm parameters that need to be encoded together with the signature mechanism identifier.
|
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 PrivateKeySignature(PrivateKey pk, String hashAlgorithm, String signatureAlgorithm, String provider, IApplicableSignatureParams params)
PrivateKeySignature instance.pk - A PrivateKey object.hashAlgorithm - A hash algorithm (e.g. "SHA-1", "SHA-256",...).signatureAlgorithm - A signiture algorithm (e.g. "RSASSA-PSS", "id-signedData",
"sha256WithRSAEncryption", ...)provider - A security provider (e.g. "BC").params - Parameters for using RSASSA-PSS or other algorithms requiring them.public String getDigestAlgorithmName()
getDigestAlgorithmName in interface IExternalSignaturepublic String getSignatureAlgorithmName()
getSignatureAlgorithmName in interface IExternalSignaturepublic ISignatureMechanismParams getSignatureMechanismParameters()
RSASSAPSSMechanismParams.getSignatureMechanismParameters in interface IExternalSignaturepublic byte[] sign(byte[] message)
throws GeneralSecurityException
sign in interface IExternalSignaturemessage - The message you want to be hashed and signed.GeneralSecurityException - when requested cryptographic algorithm or security provider
is not availableCopyright © 1998–2023 Apryse Group NV. All rights reserved.