Module io.github.mmm.crypto
Class SignatureProcessorFactoryImpl<S extends SignatureBinary,PR extends PrivateKey,PU extends PublicKey>
- java.lang.Object
-
- io.github.mmm.crypto.algorithm.AbstractSecurityAlgorithm
-
- io.github.mmm.crypto.algorithm.AbstractCryptoAlgorithmWithProvider
-
- io.github.mmm.crypto.algorithm.AbstractCryptoAlgorithmWithRandom
-
- io.github.mmm.crypto.asymmetric.sign.SignatureProcessorFactoryImpl<S,PR,PU>
-
- Type Parameters:
S- type ofSignatureBinary.PR- type ofPrivateKey.PU- type ofPublicKey.
- All Implemented Interfaces:
CryptoAlgorithm,SignatureFactory<S>,SignatureProcessorFactory<S,PR,PU>
public class SignatureProcessorFactoryImpl<S extends SignatureBinary,PR extends PrivateKey,PU extends PublicKey> extends AbstractCryptoAlgorithmWithRandom implements SignatureProcessorFactory<S,PR,PU>
Default implementation ofSignatureProcessorFactorybased onSignature.- Since:
- 1.0.0
- Author:
- Joerg Hohwiller (hohwille at users.sourceforge.net)
-
-
Field Summary
-
Fields inherited from class io.github.mmm.crypto.algorithm.AbstractCryptoAlgorithmWithProvider
provider
-
-
Constructor Summary
Constructors Constructor Description SignatureProcessorFactoryImpl(SignatureConfig<S> config, RandomFactory randomFactory)The constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ScreateSignature(byte[] data)StringgetAlgorithm()SignatureProcessorFactory<S,PR,PU>getSignatureFactoryWithoutHash()SignatureSigner<S>newSigner(PR privateKey)SignatureVerifier<S>newVerifier(PU publicKey)-
Methods inherited from class io.github.mmm.crypto.algorithm.AbstractCryptoAlgorithmWithRandom
createSecureRandom, getRandomFactory
-
Methods inherited from class io.github.mmm.crypto.algorithm.AbstractCryptoAlgorithmWithProvider
getProvider
-
Methods inherited from class io.github.mmm.crypto.algorithm.AbstractSecurityAlgorithm
creationFailedException, creationFailedException, creationFailedException, creationFailedException, getAlgorithm, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.github.mmm.crypto.asymmetric.sign.SignatureProcessorFactory
newSignerUnsafe, newVerifierUnsafe
-
-
-
-
Constructor Detail
-
SignatureProcessorFactoryImpl
public SignatureProcessorFactoryImpl(SignatureConfig<S> config, RandomFactory randomFactory)
The constructor.- Parameters:
config- theSignatureConfig.randomFactory- theRandomFactory.
-
-
Method Detail
-
getAlgorithm
public String getAlgorithm()
- Specified by:
getAlgorithmin interfaceCryptoAlgorithm- Returns:
- the name of the underlying algorithm (e.g. "RSA", "NONEwithECDSA", etc.).
- See Also:
Key.getAlgorithm(),Signature.getAlgorithm(),MessageDigest.getAlgorithm(),SecureRandom.getAlgorithm(),Cipher.getAlgorithm()
-
newSigner
public SignatureSigner<S> newSigner(PR privateKey)
- Specified by:
newSignerin interfaceSignatureProcessorFactory<S extends SignatureBinary,PR extends PrivateKey,PU extends PublicKey>- Parameters:
privateKey- thePrivateKeyto use for signing.- Returns:
- the
SignatureSignerfor signing.
-
newVerifier
public SignatureVerifier<S> newVerifier(PU publicKey)
- Specified by:
newVerifierin interfaceSignatureProcessorFactory<S extends SignatureBinary,PR extends PrivateKey,PU extends PublicKey>- Parameters:
publicKey- thePublicKeyto use for verifying.- Returns:
- the
SignatureVerifierfor verifying.
-
createSignature
public S createSignature(byte[] data)
- Specified by:
createSignaturein interfaceSignatureFactory<S extends SignatureBinary>- Parameters:
data- thebinary signature data.- Returns:
- the deserialized
SignatureBinary.
-
getSignatureFactoryWithoutHash
public SignatureProcessorFactory<S,PR,PU> getSignatureFactoryWithoutHash()
- Specified by:
getSignatureFactoryWithoutHashin interfaceSignatureProcessorFactory<S extends SignatureBinary,PR extends PrivateKey,PU extends PublicKey>- Returns:
- an instance of this
SignatureFactorythat does not hash before signing so you can control the hashing manually and only sign the resulting hash (e.g. to reuse the hash value for further calculations).
-
-