|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.crypto.KeyAgreementSpi
Service Provider Interface (SPI) for the KeyAgreement class.
Attention: This is not a SUN implementation!
This class has been developed by IAIK according to the documentation publically available.
For SUN´s documentation of this class see
http://java.sun.com/security/JCE1.2/spec/apidoc/index.html
This SPI class has to be implemented by a particular provider for every key agreement algorithm to be supported.
The corresponding API class actually used by an application for key agreement is
the javax.crypto.KeyAgreement
class.
A KeyAgreement object is created using a proper KeyAgreement.getInstance()
factory method.
After initializing the KeyAgreement object, each requested phase is performed by the
doPhase
method thereby using an extra flag for explicitly specifying if the actually executed phase
already is the last phase of this key agreement. Finally, each involved party creates the shared secret by calling
a generateSecret
method.
After the shared secret finally has been created, the KeyAgreement object is reset for being able to be used for further key agreements, either by using the same private key information as specified at the beginning of the key agreement, or using new parameters by properly initializing this KeyAgreement object again.
KeyAgreement
Constructor Summary | |
KeyAgreementSpi()
Default Constructor. |
Method Summary | |
protected abstract Key |
engineDoPhase(Key key,
boolean lastPhase)
Returns the key resulting from the next phase of this key agreement. |
protected abstract byte[] |
engineGenerateSecret()
Returns the shared secret finally generated by this key agreement. |
protected abstract int |
engineGenerateSecret(byte[] sharedSecret,
int offset)
Generates the shared secret finishing this key agreement procedure and writes it into the given byte array, beginning at the given offset position. |
protected abstract SecretKey |
engineGenerateSecret(String algorithm)
Returns the shared secret finally generated by this key agreement as SecretKey to be used for the secret key algorithm given by its name. |
protected abstract void |
engineInit(Key key,
AlgorithmParameterSpec params,
SecureRandom random)
Initializes this KeyAgreement with the given key, algorithm parameters, and random seed. |
protected abstract void |
engineInit(Key key,
SecureRandom random)
Initializes this KeyAgreement with the given key and random seed, where the given key constitutes the private key (including all required algorithm parameters) of some entity being involved in this key agreement procedure. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public KeyAgreementSpi()
Method Detail |
protected abstract void engineInit(Key key, SecureRandom random) throws InvalidKeyException
doFinal
methods will represent public key material of
another participated entity or key material resulting from some previously performed phase (if there
are more than two entities involved in the key agreement).key
- the private key information of the entity involved in the key agreementrandom
- the random seedInvalidKeyException
- if the given key cannot be used for this key agreementprotected abstract void engineInit(Key key, AlgorithmParameterSpec params, SecureRandom random) throws InvalidKeyException, InvalidAlgorithmParameterException
doFinal
methods will represent public key material of
another participated entity or key material resulting from some previously performed phase (if there
are more than two entities involved in the key agreement).key
- the private key information of the entity involved in the key agreementparams
- the algorithm parameters used for this key agreement algorithmrandom
- the random seedInvalidKeyException
- if the given key cannot be used for this key agreementInvalidAlgorithmParameterException
- if the given parameters do not match to this key agreement algorithmprotected abstract Key engineDoPhase(Key key, boolean lastPhase) throws InvalidKeyException, IllegalStateException
key
- the required key for this phase, supplied by some other entity involved in this key agreementlastPhase
- true
if this is the last phase of this key agreemant, false
if notnull
if no key is returned by this phaseInvalidKeyException
- if the given key cannot be used for this key agreement algorithm / phaseIllegalStateException
- if the given phase cannot be performed in this state of the key agreement procedureprotected abstract byte[] engineGenerateSecret() throws IllegalStateException
IllegalStateException
- if this key agreement procedure yet is not ready for being finished by generating the shared secretprotected abstract int engineGenerateSecret(byte[] sharedSecret, int offset) throws IllegalStateException, ShortBufferException
sharedSecret
- the byte array to which the generated secret has to be writtenoffset
- the offset indicating the start position within the output byte array
to which to write the generated shared secretIllegalStateException
- if this key agreement procedure yet is not ready for being finished by generating the shared secretShortBufferException
- if the given output buffer is too small for holding the secretprotected abstract SecretKey engineGenerateSecret(String algorithm) throws IllegalStateException, NoSuchAlgorithmException, InvalidKeyException
algorithm
- the name of the secret key algorithm for which the generated secret key shall be usedIllegalStateException
- if this key agreement procedure yet is not ready for being finished by generating the shared secretNoSuchAlgorithmException
- if the given secret key algorithm is not supportedInvalidKeyException
- if the generated shared secret cannot be returned as SecretKey matching to the given algorithm
|
This Javadoc may contain text parts from Internet Standard specifications (RFC 2459, 3280, 3039, 2560, 1521, 821, 822, 2253, 1319, 1321, ,2630, 2631, 2268, 3058, 2984, 2104, 2144, 2040, 2311, 2279, see copyright note) and RSA Data Security Public-Key Cryptography Standards (PKCS#1,3,5,7,8,9,10,12, see copyright note). | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |