Class Iso9796d2PssSigner
- Namespace
- Org.BouncyCastle.Crypto.Signers
- Assembly
- BouncyCastle.Cryptography.dll
ISO9796-2 - mechanism using a hash function with recovery (scheme 2 and 3).
Note: the usual length for the salt is the length of the hash function used in bytes.
public class Iso9796d2PssSigner : ISignerWithRecovery, ISigner
- Inheritance
-
Iso9796d2PssSigner
- Implements
- Inherited Members
Constructors
Iso9796d2PssSigner(IAsymmetricBlockCipher, IDigest, int)
Generate a signer with explicit trailer for ISO9796-2, scheme 2 or 3.
public Iso9796d2PssSigner(IAsymmetricBlockCipher cipher, IDigest digest, int saltLength)
Parameters
cipherIAsymmetricBlockCipherbase cipher to use for signature creation/verification
digestIDigestdigest to use.
saltLengthintlength of salt in bytes.
Iso9796d2PssSigner(IAsymmetricBlockCipher, IDigest, int, bool)
Generate a signer with either implicit or explicit trailer for ISO9796-2, scheme 2 or 3.
public Iso9796d2PssSigner(IAsymmetricBlockCipher cipher, IDigest digest, int saltLength, bool isImplicit)
Parameters
cipherIAsymmetricBlockCipherbase cipher to use for signature creation/verification
digestIDigestdigest to use.
saltLengthintlength of salt in bytes.
isImplicitboolwhether or not the trailer is implicit or gives the hash.
Properties
AlgorithmName
The algorithm name.
public virtual string AlgorithmName { get; }
Property Value
Methods
BlockUpdate(byte[], int, int)
Update the signer with a block of bytes.
public virtual void BlockUpdate(byte[] input, int inOff, int inLen)
Parameters
inputbyte[]the byte array containing the data.
inOffintthe offset into the byte array where the data starts.
inLenintthe length of the data.
BlockUpdate(ReadOnlySpan<byte>)
Update the signer with a span of bytes.
public virtual void BlockUpdate(ReadOnlySpan<byte> input)
Parameters
inputReadOnlySpan<byte>the span containing the data.
GenerateSignature()
Generate a signature for the loaded message using the key we were initialised with.
public virtual byte[] GenerateSignature()
Returns
- byte[]
GetMaxSignatureSize()
public virtual int GetMaxSignatureSize()
Returns
GetRecoveredMessage()
Return a reference to the recoveredMessage message.
public byte[] GetRecoveredMessage()
Returns
- byte[]
The full/partial recoveredMessage message.
- See Also
HasFullMessage()
Return true if the full message was recoveredMessage.
public virtual bool HasFullMessage()
Returns
- bool
true on full message recovery, false otherwise, or if not sure.
- See Also
Init(bool, ICipherParameters)
Initialise the signer.
public virtual void Init(bool forSigning, ICipherParameters parameters)
Parameters
forSigningbooltrue if for signing, false if for verification.
parametersICipherParametersparameters for signature generation/verification. If the parameters are for generation they should be a ParametersWithRandom, a ParametersWithSalt, or just an RsaKeyParameters object. If RsaKeyParameters are passed in a SecureRandom will be created.
Exceptions
- ArgumentException
if wrong parameter type or a fixed salt is passed in which is the wrong length.
Reset()
reset the internal state
public virtual void Reset()
Update(byte)
update the internal digest with the byte b
public virtual void Update(byte input)
Parameters
inputbyte
UpdateWithRecoveredMessage(byte[])
Perform an update with the recovered message before adding any other data. This must be the first update method called, and calling it will result in the signer assuming that further calls to update will include message content past what is recoverable.
@param signature the signature that we are in the process of verifying. @throws IllegalStateException
public virtual void UpdateWithRecoveredMessage(byte[] signature)
Parameters
signaturebyte[]
VerifySignature(byte[])
return true if the signature represents a ISO9796-2 signature for the passed in message.
public virtual bool VerifySignature(byte[] signature)
Parameters
signaturebyte[]