|
For the latest news and information visit The GNU Crypto project |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object gnu.crypto.key.BaseKeyAgreementParty
A base abstract class to facilitate implementations of concrete key agreement protocol handlers.
Field Summary | |
protected boolean |
complete
Whether the exchange has concluded or not. |
protected boolean |
initialised
Whether the instance is initialised or not. |
protected java.lang.String |
name
The canonical name of the protocol. |
protected java.security.SecureRandom |
rnd
The optional SecureRandom instance to use. |
protected int |
step
The current step index of the protocol exchange. |
protected static java.math.BigInteger |
TWO
|
Constructor Summary | |
protected |
BaseKeyAgreementParty(java.lang.String name)
|
Method Summary | |
protected abstract void |
engineInit(java.util.Map attributes)
|
protected abstract OutgoingMessage |
engineProcessMessage(IncomingMessage in)
|
protected abstract void |
engineReset()
|
protected abstract byte[] |
engineSharedSecret()
|
byte[] |
getSharedSecret()
Returns the byte array containing the shared secret as generated by this party. |
void |
init(java.util.Map attributes)
Sets up the instance to operate with specific attributes. |
boolean |
isComplete()
Returns true if the party in the key agreement protocol
exchange has completed its part of the exchange. |
java.lang.String |
name()
Returns the canonical name of the key agreement protocol. |
protected void |
nextRandomBytes(byte[] buffer)
Fills the designated byte array with random data. |
OutgoingMessage |
processMessage(IncomingMessage in)
Processes an incoming message at one end, generating a message that will be processed by the other party(ies). |
void |
reset()
Resets this instance for re-use with another set of attributes. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static final java.math.BigInteger TWO
protected java.lang.String name
protected boolean initialised
protected int step
protected boolean complete
protected java.security.SecureRandom rnd
SecureRandom
instance to use.
Constructor Detail |
protected BaseKeyAgreementParty(java.lang.String name)
Method Detail |
public java.lang.String name()
IKeyAgreementParty
Returns the canonical name of the key agreement protocol.
name
in interface IKeyAgreementParty
public void init(java.util.Map attributes) throws KeyAgreementException
IKeyAgreementParty
Sets up the instance to operate with specific attributes.
init
in interface IKeyAgreementParty
attributes
- a map of name-values used by concrete implementations.
KeyAgreementException
- if an exception occurs during the setup.public OutgoingMessage processMessage(IncomingMessage in) throws KeyAgreementException
IKeyAgreementParty
Processes an incoming message at one end, generating a message that will be processed by the other party(ies).
processMessage
in interface IKeyAgreementParty
in
- the incoming message.
null
if this is an
intermediary step that does not cause any output.
KeyAgreementException
- if an exception occurs during the processing
of the incoming message, or during the generation of the outgoing message.public boolean isComplete()
IKeyAgreementParty
Returns true
if the party in the key agreement protocol
exchange has completed its part of the exchange. If this is the case an
IllegalStateException
is thrown for any method invocation except
init()
or reset()
.
isComplete
in interface IKeyAgreementParty
true
if this party has completed its part of the key
agreement protocol exchange; false
otherwise.public byte[] getSharedSecret() throws KeyAgreementException
IKeyAgreementParty
Returns the byte array containing the shared secret as generated by this party.
getSharedSecret
in interface IKeyAgreementParty
KeyAgreementException
- if the key agreement is not yet initialised,
or is initialised but the exchange is still in progress.public void reset()
IKeyAgreementParty
reset
in interface IKeyAgreementParty
protected abstract void engineInit(java.util.Map attributes) throws KeyAgreementException
KeyAgreementException
protected abstract OutgoingMessage engineProcessMessage(IncomingMessage in) throws KeyAgreementException
KeyAgreementException
protected abstract byte[] engineSharedSecret() throws KeyAgreementException
KeyAgreementException
protected abstract void engineReset()
protected void nextRandomBytes(byte[] buffer)
buffer
- the byte array to fill with random data.
|
For the latest news and information visit The GNU Crypto project |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |