Module io.github.mmm.crypto
Class SignatureProcessorFactoryImplCryptorWithHash<PR extends PrivateKey,PU extends PublicKey>
- java.lang.Object
-
- io.github.mmm.crypto.asymmetric.sign.SignatureProcessorFactoryImplCryptorWithHash<PR,PU>
-
- Type Parameters:
PR
- type ofPrivateKey
.PU
- type ofPublicKey
.
- All Implemented Interfaces:
SignatureFactory<SignatureBinary>
,SignatureProcessorFactory<SignatureBinary,PR,PU>
public class SignatureProcessorFactoryImplCryptorWithHash<PR extends PrivateKey,PU extends PublicKey> extends Object implements SignatureProcessorFactory<SignatureBinary,PR,PU>
- Since:
- 1.0.0
- Author:
- Joerg Hohwiller (hohwille at users.sourceforge.net)
-
-
Constructor Summary
Constructors Constructor Description SignatureProcessorFactoryImplCryptorWithHash(AsymmetricCryptorFactory<PR,PU> cryptorFactory, HashFactory hashFactory)
The constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SignatureBinary
createSignature(byte[] data)
SignatureProcessorFactory<SignatureBinary,PR,PU>
getSignatureFactoryWithoutHash()
SignatureSigner<SignatureBinary>
newSigner(PR privateKey)
SignatureVerifier<SignatureBinary>
newVerifier(PU publicKey)
String
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
-
SignatureProcessorFactoryImplCryptorWithHash
public SignatureProcessorFactoryImplCryptorWithHash(AsymmetricCryptorFactory<PR,PU> cryptorFactory, HashFactory hashFactory)
The constructor.- Parameters:
cryptorFactory
- theAsymmetricCryptorFactory
to delegate to.hashFactory
- theHashFactory
to apply as extension.
-
-
Method Detail
-
newSigner
public SignatureSigner<SignatureBinary> newSigner(PR privateKey)
- Specified by:
newSigner
in interfaceSignatureProcessorFactory<SignatureBinary,PR extends PrivateKey,PU extends PublicKey>
- Parameters:
privateKey
- thePrivateKey
to use for signing.- Returns:
- the
SignatureSigner
for signing.
-
newVerifier
public SignatureVerifier<SignatureBinary> newVerifier(PU publicKey)
- Specified by:
newVerifier
in interfaceSignatureProcessorFactory<SignatureBinary,PR extends PrivateKey,PU extends PublicKey>
- Parameters:
publicKey
- thePublicKey
to use for verifying.- Returns:
- the
SignatureVerifier
for verifying.
-
createSignature
public SignatureBinary createSignature(byte[] data)
- Specified by:
createSignature
in interfaceSignatureFactory<PR extends PrivateKey>
- Parameters:
data
- thebinary signature data
.- Returns:
- the deserialized
SignatureBinary
.
-
getSignatureFactoryWithoutHash
public SignatureProcessorFactory<SignatureBinary,PR,PU> getSignatureFactoryWithoutHash()
- Specified by:
getSignatureFactoryWithoutHash
in interfaceSignatureProcessorFactory<SignatureBinary,PR extends PrivateKey,PU extends PublicKey>
- Returns:
- an instance of this
SignatureFactory
that 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).
-
-