|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--javax.crypto.KeyAgreementSpi
|
+--de.flexiprovider.api.KeyAgreement
|
+--de.flexiprovider.ec.ECSVDPDHC
ECSVDPDHC provides the implementation for key exchange with the Diffie Hellman algorithm on elliptic curves GP(p), where p is an odd prime number.
This class implements the ECSVDP-DHC primitive from IEEE 1363, i.e. the Diffie Hellman algorithm with co-factor multiplication.
Usage:
kagA and kagB represent the parties trying to establish a shared secret key, each with a private and public key. The following steps have to be performed:
KeyAgreement kagA = KeyAgreement.getInstance("ECDH", "FlexiEC");
kagA.init(ecprivA, params, random);
KeyAgreement kagB = KeyAgreement.getInstance("ECDH", "FlexiEC");
kagB.init(ecprivB, random);
ECSecretKey secrA = (ECSecretKey) kagA.doPhase(ecpubB, true);
ECSecretKey secrB = (ECSecretKey) kagB.doPhase(ecpubA, true);
ECPrivateKey,
ECPublicKey,
ECSecretKey| Field Summary | |
protected boolean |
withCoFactor
flag indicating whether cofactor multiplication shall be used |
| Constructor Summary | |
ECSVDPDHC()
|
|
| Method Summary | |
Key |
doPhase(PublicKey key,
boolean lastPhase)
Executes the next phase of this key agreement with the given key that was received from one of the other parties involved in this key agreement. |
byte[] |
generateSecret()
Generates the shared Secret and returns it as an byte-array. |
int |
generateSecret(byte[] sharedSecret,
int offset)
Generates the shared secret, and places it into the buffer sharedSecret, beginning at offset inclusive. |
SecretKey |
generateSecret(java.lang.String algorithm)
Generate the shared secret via the algorithm specified in algorithm. |
void |
init(PrivateKey key,
AlgorithmParameterSpec params,
SecureRandom random)
Initializes this ECSVDPDHC with a key, the curve parameters and some random information which is not being used here. |
void |
init(PrivateKey key,
SecureRandom random)
Initializes this ECSVDPDHC with a key and some random information which is not being used here. |
| Methods inherited from class de.flexiprovider.api.KeyAgreement |
engineDoPhase, engineGenerateSecret, engineGenerateSecret, engineGenerateSecret, engineInit, engineInit |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
protected boolean withCoFactor
| Constructor Detail |
public ECSVDPDHC()
| Method Detail |
public void init(PrivateKey key,
AlgorithmParameterSpec params,
SecureRandom random)
throws InvalidKeyException
init in class KeyAgreementkey - is the private key of the party initializing ECSVDPDHCparams - are the curve parametersrandom - contains some random information that are randomly ignoredInvalidKeyException - if key is no instance of ECPrivateKey.
public void init(PrivateKey key,
SecureRandom random)
throws InvalidKeyException
key - is the secret key of the party initializing ECSVDPDHCrandom - contains some random information that are randomly ignoredInvalidKeyException - if key is no instance of
ECPrivateKey
public SecretKey generateSecret(java.lang.String algorithm)
throws NoSuchAlgorithmException
generateSecret in class KeyAgreementalgorithm - is the desired algorithm for the generation of the secretSecretKeyNoSuchAlgorithmException - if algorithm isn't ECDH
public int generateSecret(byte[] sharedSecret,
int offset)
throws ShortBufferException
generateSecret in class KeyAgreementsharedSecret - is the buffer for the shared secretoffset - is the offset in sharedSecret where the shared
secret will be storedShortBufferException - if sharedSecret is too small to to hold the
shared secretpublic byte[] generateSecret()
generateSecret in class KeyAgreement
public Key doPhase(PublicKey key,
boolean lastPhase)
throws InvalidKeyException
doPhase in class KeyAgreementkey - the public key of the other partylastPhase - true, if this is the last phase of the key agreement.
After the last phase only generateSecret should
be called.InvalidKeyException - if key is no interface of an
ECPublicKey or if key is an invalid
ECPublicKey
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||