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

public Class ECNRSigner

extends Object
implements DSAExt
Class Inheritance
All Implemented Interfaces
org.bouncycastle.crypto.DSAExt, org.bouncycastle.crypto.DSA
Imports
java.math.BigInteger, java.security.SecureRandom, org.bouncycastle.crypto.AsymmetricCipherKeyPair, .CipherParameters, .CryptoServicesRegistrar, .DSAExt, .DataLengthException, org.bouncycastle.crypto.generators.ECKeyPairGenerator, org.bouncycastle.crypto.params.ECKeyGenerationParameters, .ECKeyParameters, .ECPrivateKeyParameters, .ECPublicKeyParameters, .ParametersWithRandom, org.bouncycastle.math.ec.ECAlgorithms, .ECConstants, .ECPoint, org.bouncycastle.util.BigIntegers

EC-NR as described in IEEE 1363-2000 - a signature algorithm for Elliptic Curve which also offers message recovery.

Field Summary

Modifier and TypeField and Description
private boolean
private ECKeyParameters
private SecureRandom

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private BigInteger
public BigInteger[]
generateSignature(byte[]
the digest to be signed.
digest
)

Implements org.bouncycastle.crypto.DSA.generateSignature.

generate a signature for the given message using the key we were initialised with.
public BigInteger
getOrder()

Implements org.bouncycastle.crypto.DSAExt.getOrder.

Get the order of the group that the r, s values in signatures belong to.
public byte[]

Returns:

null if r and s are not valid.
getRecoveredMessage
(BigInteger r, BigInteger s)

Returns the data used for the signature generation, assuming the public key passed to init() is correct.

public void
init(boolean
true if we are generating a signature, false for verification or if we want to use the signer for message recovery.
forSigning
,
CipherParameters
key parameters for signature generation.
param
)

Implements org.bouncycastle.crypto.DSA.init.

Initialise the signer.
public boolean
verifySignature(byte[]
the digest to be verified.
digest
,
BigInteger
the r value of the signature.
r
,
BigInteger
the s value of the signature.
s
)

Implements org.bouncycastle.crypto.DSA.verifySignature.

return true if the value r and s represent a signature for the message passed in. Generally, the order of the curve should be at least as long as the hash of the message of interest, and with ECNR, it *must* be at least as long.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

forSigningback to summary
private boolean forSigning
keyback to summary
private ECKeyParameters key
randomback to summary
private SecureRandom random

Constructor Detail

ECNRSignerback to summary
public ECNRSigner()

Method Detail

extractTback to summary
private BigInteger extractT(ECPublicKeyParameters pubKey, BigInteger r, BigInteger s)
generateSignatureback to summary
public BigInteger[] generateSignature(byte[] digest)

Implements org.bouncycastle.crypto.DSA.generateSignature.

generate a signature for the given message using the key we were initialised with. Generally, the order of the curve should be at least as long as the hash of the message of interest, and with ECNR it *must* be at least as long.

Parameters
digest:byte[]

the digest to be signed.

Returns:BigInteger[]

Doc from org.bouncycastle.crypto.DSA.generateSignature.

two big integers representing the r and s values respectively.

Exceptions
DataLengthException:
if the digest is longer than the key allows
getOrderback to summary
public BigInteger getOrder()

Implements org.bouncycastle.crypto.DSAExt.getOrder.

Doc from org.bouncycastle.crypto.DSAExt.getOrder.

Get the order of the group that the r, s values in signatures belong to.

getRecoveredMessageback to summary
public byte[] getRecoveredMessage(BigInteger r, BigInteger s)

Returns the data used for the signature generation, assuming the public key passed to init() is correct.

Returns:byte[]

null if r and s are not valid.

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

Implements org.bouncycastle.crypto.DSA.init.

Initialise the signer.

Parameters
forSigning:boolean

true if we are generating a signature, false for verification or if we want to use the signer for message recovery.

param:CipherParameters

key parameters for signature generation.

verifySignatureback to summary
public boolean verifySignature(byte[] digest, BigInteger r, BigInteger s)

Implements org.bouncycastle.crypto.DSA.verifySignature.

return true if the value r and s represent a signature for the message passed in. Generally, the order of the curve should be at least as long as the hash of the message of interest, and with ECNR, it *must* be at least as long. But just in case the signer applied mod(n) to the longer digest, this implementation will apply mod(n) during verification.

Parameters
digest:byte[]

the digest to be verified.

r:BigInteger

the r value of the signature.

s:BigInteger

the s value of the signature.

Exceptions
DataLengthException:
if the digest is longer than the key allows