Package org.forgerock.secrets.keys
Class SigningKey
- java.lang.Object
-
- org.forgerock.secrets.Secret
-
- org.forgerock.secrets.keys.CryptoKey
-
- org.forgerock.secrets.keys.SigningKey
-
- All Implemented Interfaces:
AutoCloseable
public class SigningKey extends CryptoKey
A key that is used for signing digital signatures. This also encompasses message authenticate codes (MACs), which are treated as "symmetric signatures" by this framework for consistency and simplicity.
-
-
Constructor Summary
Constructors Constructor Description SigningKey(SecretBuilder builder)
Initialises the key with the given secret data.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Signature
getSignature()
Returns an initialised signature object for a default signature algorithm for this key type.Signature
getSignature(String algorithm)
Returns a signature object initialised for signing.-
Methods inherited from class org.forgerock.secrets.keys.CryptoKey
allowsAlgorithm, close, export, getCertificate, getCertificate, getCertificateChain, getCertificateChain, getKeyAlgorithm, getKeyType, getKeyUsages, getPublicKey, getPublicKey, isClosed, isExtractable, reveal, revealAndClose, toBuilder, toString
-
Methods inherited from class org.forgerock.secrets.Secret
equals, getExpiryTime, getStableId, hashCode, isExpired
-
-
-
-
Constructor Detail
-
SigningKey
public SigningKey(SecretBuilder builder) throws NoSuchSecretException
Initialises the key with the given secret data.- Parameters:
builder
- the builder object.- Throws:
NoSuchSecretException
- if the secret could not be constructed from the builder.
-
-
Method Detail
-
getSignature
public Signature getSignature(String algorithm)
Returns a signature object initialised for signing. If the signature algorithm is for ECDSA and the key is extractable then this will attempt to return a deterministic ECDSA signature instance unless the system property "org.forgerock.secrets.preferDeterministicEcdsa" is set to "false".- Parameters:
algorithm
- the signature algorithm.- Returns:
- the initialised signature object.
-
getSignature
public Signature getSignature()
Returns an initialised signature object for a default signature algorithm for this key type.- Returns:
- the initialized signature object.
-
-