Top Description Fields Constructors Methods
org.bouncycastle.crypto.signers

public Class ISO9796d2Signer

extends Object
implements SignerWithRecovery
Class Inheritance
All Implemented Interfaces
org.bouncycastle.crypto.SignerWithRecovery, org.bouncycastle.crypto.Signer
Imports
org.bouncycastle.crypto.AsymmetricBlockCipher, .CipherParameters, .CryptoException, .Digest, .InvalidCipherTextException, .SignerWithRecovery, org.bouncycastle.crypto.params.RSAKeyParameters, org.bouncycastle.util.Arrays

ISO9796-2 - mechanism using a hash function with recovery (scheme 1)

Field Summary

Modifier and TypeField and Description
private byte[]
private AsymmetricBlockCipher
private Digest
private boolean
private int
private byte[]
private int
private byte[]
private byte[]
private byte[]
private int
public static final int
TRAILER_IMPLICIT

Deprecated use ISOTrailers
public static final int
TRAILER_RIPEMD128

Deprecated use ISOTrailers
public static final int
TRAILER_RIPEMD160

Deprecated use ISOTrailers
public static final int
TRAILER_SHA1

Deprecated use ISOTrailers
public static final int
TRAILER_SHA256

Deprecated use ISOTrailers
public static final int
TRAILER_SHA384

Deprecated use ISOTrailers
public static final int
TRAILER_SHA512

Deprecated use ISOTrailers
public static final int
TRAILER_WHIRLPOOL

Deprecated use ISOTrailers

Constructor Summary

AccessConstructor and Description
public
ISO9796d2Signer(AsymmetricBlockCipher
base cipher to use for signature creation/verification
cipher
,
Digest
digest to use.
digest
,
boolean
whether or not the trailer is implicit or gives the hash.
implicit
)

Generate a signer with either implicit or explicit trailers for ISO9796-2.

public
ISO9796d2Signer(AsymmetricBlockCipher
cipher to use.
cipher
,
Digest
digest to sign with.
digest
)

Constructor for a signer with an explicit digest trailer.

Method Summary

Modifier and TypeMethod and Description
private void
clearBlock(byte[] block)

clear possible sensitive data

public byte[]
generateSignature()

Implements org.bouncycastle.crypto.Signer.generateSignature.

generate a signature for the loaded message using the key we were initialised with.

public byte[]

Returns:

the full/partial recoveredMessage message.
getRecoveredMessage
()

Implements org.bouncycastle.crypto.SignerWithRecovery.getRecoveredMessage.

Return a reference to the recoveredMessage message, either as it was added to a just generated signature, or extracted from a verified one.

public boolean

Returns:

true on full message recovery, false otherwise.
hasFullMessage
()

Implements org.bouncycastle.crypto.SignerWithRecovery.hasFullMessage.

Return true if the full message was recoveredMessage.

public void
init(boolean
true if for signing, false otherwise
forSigning
,
CipherParameters
necessary parameters.
param
)

Implements org.bouncycastle.crypto.Signer.init.

Initialise the signer for signing or verification.

private boolean
isSameAs(byte[] a, byte[] b)

compare two byte arrays - constant time

public void
reset()

Implements org.bouncycastle.crypto.Signer.reset.

reset the internal state

private boolean
returnFalse(byte[] block)

public void
update(byte b)

Implements org.bouncycastle.crypto.Signer.update.

update the internal digest with the byte b

public void
update(byte[] in, int off, int len)

Implements org.bouncycastle.crypto.Signer.update.

update the internal digest with the byte array in

public void
updateWithRecoveredMessage(byte[]
the signature that we are in the process of verifying.
signature
)

Implements org.bouncycastle.crypto.SignerWithRecovery.updateWithRecoveredMessage.

Perform an update with the recovered message before adding any other data.

public boolean
verifySignature(byte[] signature)

Implements org.bouncycastle.crypto.Signer.verifySignature.

return true if the signature represents a ISO9796-2 signature for the passed in message.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

blockback to summary
private byte[] block
cipherback to summary
private AsymmetricBlockCipher cipher
digestback to summary
private Digest digest
fullMessageback to summary
private boolean fullMessage
keyBitsback to summary
private int keyBits
mBufback to summary
private byte[] mBuf
messageLengthback to summary
private int messageLength
preBlockback to summary
private byte[] preBlock
preSigback to summary
private byte[] preSig
recoveredMessageback to summary
private byte[] recoveredMessage
trailerback to summary
private int trailer
TRAILER_IMPLICITback to summary
public static final int TRAILER_IMPLICIT

Deprecated

use ISOTrailers

TRAILER_RIPEMD128back to summary
public static final int TRAILER_RIPEMD128

Deprecated

use ISOTrailers

TRAILER_RIPEMD160back to summary
public static final int TRAILER_RIPEMD160

Deprecated

use ISOTrailers

TRAILER_SHA1back to summary
public static final int TRAILER_SHA1

Deprecated

use ISOTrailers

TRAILER_SHA256back to summary
public static final int TRAILER_SHA256

Deprecated

use ISOTrailers

TRAILER_SHA384back to summary
public static final int TRAILER_SHA384

Deprecated

use ISOTrailers

TRAILER_SHA512back to summary
public static final int TRAILER_SHA512

Deprecated

use ISOTrailers

TRAILER_WHIRLPOOLback to summary
public static final int TRAILER_WHIRLPOOL

Deprecated

use ISOTrailers

Constructor Detail

ISO9796d2Signerback to summary
public ISO9796d2Signer(AsymmetricBlockCipher cipher, Digest digest, boolean implicit)

Generate a signer with either implicit or explicit trailers for ISO9796-2.

Parameters
cipher:AsymmetricBlockCipher

base cipher to use for signature creation/verification

digest:Digest

digest to use.

implicit:boolean

whether or not the trailer is implicit or gives the hash.

ISO9796d2Signerback to summary
public ISO9796d2Signer(AsymmetricBlockCipher cipher, Digest digest)

Constructor for a signer with an explicit digest trailer.

Parameters
cipher:AsymmetricBlockCipher

cipher to use.

digest:Digest

digest to sign with.

Method Detail

clearBlockback to summary
private void clearBlock(byte[] block)

clear possible sensitive data

generateSignatureback to summary
public byte[] generateSignature() throws CryptoException

Implements org.bouncycastle.crypto.Signer.generateSignature.

generate a signature for the loaded message using the key we were initialised with.

getRecoveredMessageback to summary
public byte[] getRecoveredMessage()

Implements org.bouncycastle.crypto.SignerWithRecovery.getRecoveredMessage.

Return a reference to the recoveredMessage message, either as it was added to a just generated signature, or extracted from a verified one.

Returns:byte[]

the full/partial recoveredMessage message.

See Also
org.bouncycastle.crypto.SignerWithRecovery#getRecoveredMessage()
hasFullMessageback to summary
public boolean hasFullMessage()

Implements org.bouncycastle.crypto.SignerWithRecovery.hasFullMessage.

Return true if the full message was recoveredMessage.

Returns:boolean

true on full message recovery, false otherwise.

See Also
org.bouncycastle.crypto.SignerWithRecovery#hasFullMessage()
initback to summary
public void init(boolean forSigning, CipherParameters param)

Implements org.bouncycastle.crypto.Signer.init.

Doc from org.bouncycastle.crypto.Signer.init.

Initialise the signer for signing or verification.

Parameters
forSigning:boolean

true if for signing, false otherwise

param:CipherParameters

necessary parameters.

isSameAsback to summary
private boolean isSameAs(byte[] a, byte[] b)

compare two byte arrays - constant time

resetback to summary
public void reset()

Implements org.bouncycastle.crypto.Signer.reset.

reset the internal state

returnFalseback to summary
private boolean returnFalse(byte[] block)
updateback to summary
public void update(byte b)

Implements org.bouncycastle.crypto.Signer.update.

update the internal digest with the byte b

updateback to summary
public void update(byte[] in, int off, int len)

Implements org.bouncycastle.crypto.Signer.update.

update the internal digest with the byte array in

updateWithRecoveredMessageback to summary
public void updateWithRecoveredMessage(byte[] signature) throws InvalidCipherTextException

Implements org.bouncycastle.crypto.SignerWithRecovery.updateWithRecoveredMessage.

Doc from org.bouncycastle.crypto.SignerWithRecovery.updateWithRecoveredMessage.

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.

Parameters
signature:byte[]

the signature that we are in the process of verifying.

verifySignatureback to summary
public boolean verifySignature(byte[] signature)

Implements org.bouncycastle.crypto.Signer.verifySignature.

return true if the signature represents a ISO9796-2 signature for the passed in message.