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

pack-priv Class HMacDsaKCalculator

extends Object
implements DsaKCalculator
Class Inheritance
All Implemented Interfaces
org.bouncycastle.crypto.general.DsaKCalculator
Imports
java.math.BigInteger, java.security.SecureRandom, org.bouncycastle.crypto.internal.Digest, org.bouncycastle.crypto.internal.macs.HMac, org.bouncycastle.crypto.internal.params.KeyParameterImpl, org.bouncycastle.util.Arrays, .BigIntegers

A deterministic K calculator based on the algorithm in section 3.2 of RFC 6979.

Field Summary

Modifier and TypeField and Description
private final HMac
private final byte[]
K

private BigInteger
n

private final byte[]
V

private static final BigInteger

Constructor Summary

AccessConstructor and Description
public
HMacDsaKCalculator(Digest
digest to build the HMAC on.
digest
)

Base constructor.

Method Summary

Modifier and TypeMethod and Description
private BigInteger
bitsToInt(byte[] t)

public void
init(BigInteger
the order of the DSA group.
n
,
SecureRandom
a source of randomness.
random
)

Implements org.bouncycastle.crypto.general.DsaKCalculator.init.

Non-deterministic initialiser.
public void
init(BigInteger
the order of the DSA group.
n
,
BigInteger
the DSA private value.
d
,
byte[]
the message being signed.
message
)

Implements org.bouncycastle.crypto.general.DsaKCalculator.init.

Deterministic initialiser.
public boolean
isDeterministic()

Implements org.bouncycastle.crypto.general.DsaKCalculator.isDeterministic.

Return true if this calculator is deterministic, false otherwise.
public BigInteger
nextK()

Implements org.bouncycastle.crypto.general.DsaKCalculator.nextK.

Return the next valid value of K.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

hMacback to summary
private final HMac hMac
Kback to summary
private final byte[] K
nback to summary
private BigInteger n
Vback to summary
private final byte[] V
ZEROback to summary
private static final BigInteger ZERO

Constructor Detail

HMacDsaKCalculatorback to summary
public HMacDsaKCalculator(Digest digest)

Base constructor.

Parameters
digest:Digest

digest to build the HMAC on.

Method Detail

bitsToIntback to summary
private BigInteger bitsToInt(byte[] t)
initback to summary
public void init(BigInteger n, SecureRandom random)

Implements org.bouncycastle.crypto.general.DsaKCalculator.init.

Doc from org.bouncycastle.crypto.general.DsaKCalculator.init.

Non-deterministic initialiser.

Parameters
n:BigInteger

the order of the DSA group.

random:SecureRandom

a source of randomness.

initback to summary
public void init(BigInteger n, BigInteger d, byte[] message)

Implements org.bouncycastle.crypto.general.DsaKCalculator.init.

Doc from org.bouncycastle.crypto.general.DsaKCalculator.init.

Deterministic initialiser.

Parameters
n:BigInteger

the order of the DSA group.

d:BigInteger

the DSA private value.

message:byte[]

the message being signed.

isDeterministicback to summary
public boolean isDeterministic()

Implements org.bouncycastle.crypto.general.DsaKCalculator.isDeterministic.

Doc from org.bouncycastle.crypto.general.DsaKCalculator.isDeterministic.

Return true if this calculator is deterministic, false otherwise.

Returns:boolean

true if deterministic, otherwise false.

nextKback to summary
public BigInteger nextK()

Implements org.bouncycastle.crypto.general.DsaKCalculator.nextK.

Doc from org.bouncycastle.crypto.general.DsaKCalculator.nextK.

Return the next valid value of K.

Returns:BigInteger

a K value.