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

public Class BaseX931Signer

extends Object
implements Signer
Class Inheritance
All Implemented Interfaces
org.bouncycastle.crypto.internal.Signer
Known Direct Subclasses
org.bouncycastle.crypto.fips.X931Signer, org.bouncycastle.crypto.general.X931Signer
Imports
java.math.BigInteger, org.bouncycastle.crypto.internal.AsymmetricBlockCipher, .CipherParameters, .CryptoException, .Digest, .Signer, org.bouncycastle.crypto.internal.params.ParametersWithRandom, .RsaKeyParameters, org.bouncycastle.crypto.internal.util.ISOTrailers, org.bouncycastle.util.Arrays, .BigIntegers

X9.31-1998 - signing using a hash.

The message digest hash, H, is encapsulated to form a byte string as follows

EB = 06 || PS || 0xBA || H || TRAILER
where PS is a string of bytes all of value 0xBB of length such that |EB|=|n|, and TRAILER is the ISO/IEC 10118 part number† for the digest. The byte string, EB, is converted to an integer value, the message representative, f.

Field Summary

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

Constructor Summary

AccessConstructor and Description
public
BaseX931Signer(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 X9.31

Method Summary

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

clear possible sensitive data

private void
createSignatureBlock(int trailer)

public byte[]
generateSignature()

Implements org.bouncycastle.crypto.internal.Signer.generateSignature.

generate a signature for the loaded message using the key we were initialised with.
public void
init(boolean
true if for signing, false otherwise
forSigning
,
CipherParameters
necessary parameters.
param
)

Implements org.bouncycastle.crypto.internal.Signer.init.

Initialise the signer for signing or verification.
public void
reset()

Implements org.bouncycastle.crypto.internal.Signer.reset.

reset the internal state
public void
update(byte b)

Implements org.bouncycastle.crypto.internal.Signer.update.

update the internal digest with the byte b
public void
update(byte[] in, int off, int len)

Implements org.bouncycastle.crypto.internal.Signer.update.

update the internal digest with the byte array in
public boolean
verifySignature(byte[] signature)

Implements org.bouncycastle.crypto.internal.Signer.verifySignature.

return true if the signature represents a X9.31 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
keyBitsback to summary
private int keyBits
kParamback to summary
private RsaKeyParameters kParam
trailerback to summary
private int trailer
TRAILER_IMPLICITback to summary
public static final int TRAILER_IMPLICIT

Constructor Detail

BaseX931Signerback to summary
public BaseX931Signer(AsymmetricBlockCipher cipher, Digest digest, boolean implicit)

Generate a signer with either implicit or explicit trailers for X9.31

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.

Method Detail

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

clear possible sensitive data

createSignatureBlockback to summary
private void createSignatureBlock(int trailer)
generateSignatureback to summary
public byte[] generateSignature() throws CryptoException

Implements org.bouncycastle.crypto.internal.Signer.generateSignature.

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

initback to summary
public void init(boolean forSigning, CipherParameters param)

Implements org.bouncycastle.crypto.internal.Signer.init.

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

Initialise the signer for signing or verification.

Parameters
forSigning:boolean

true if for signing, false otherwise

param:CipherParameters

necessary parameters.

resetback to summary
public void reset()

Implements org.bouncycastle.crypto.internal.Signer.reset.

reset the internal state

updateback to summary
public void update(byte b)

Implements org.bouncycastle.crypto.internal.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.internal.Signer.update.

update the internal digest with the byte array in

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

Implements org.bouncycastle.crypto.internal.Signer.verifySignature.

return true if the signature represents a X9.31 signature for the passed in message.