|
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.dh.DHKeyPairRawCodec
An object that implements the IKeyPairCodec
operations for the
Raw format to use with Diffie-Hellman keypairs.
Field Summary |
Fields inherited from interface gnu.crypto.key.IKeyPairCodec |
RAW_FORMAT |
Constructor Summary | |
DHKeyPairRawCodec()
|
Method Summary | |
java.security.PrivateKey |
decodePrivateKey(byte[] k)
Decodes an instance of an external private key into its native Java representation. |
java.security.PublicKey |
decodePublicKey(byte[] k)
Decodes an instance of an external public key into its native Java representation. |
byte[] |
encodePrivateKey(java.security.PrivateKey key)
Returns the encoded form of the designated Diffie-Hellman private key according to the Raw format supported by this library. |
byte[] |
encodePublicKey(java.security.PublicKey key)
Returns the encoded form of the designated Diffie-Hellman public key according to the Raw format supported by this library. |
int |
getFormatID()
Returns the unique identifier (within this library) of the format used to externalise public and private keys. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DHKeyPairRawCodec()
Method Detail |
public int getFormatID()
IKeyPairCodec
Returns the unique identifier (within this library) of the format used to externalise public and private keys.
getFormatID
in interface IKeyPairCodec
public byte[] encodePublicKey(java.security.PublicKey key)
Returns the encoded form of the designated Diffie-Hellman public key according to the Raw format supported by this library.
The Raw format for a DH public key, in this implementation, is a byte sequence consisting of the following:
Registry.MAGIC_RAW_DH_PUBLIC_KEY
,q
in internet order,BigInteger
obtained by invoking
the toByteArray()
method on the DH parameter q
,p
in internet order,BigInteger
obtained by invoking
the toByteArray()
method on the DH parameter p
,g
,BigInteger
obtained by invoking
the toByteArray()
method on the DH parameter g
,y
,BigInteger
obtained by invoking
the toByteArray()
method on the DH parameter y
,
encodePublicKey
in interface IKeyPairCodec
key
- the key to encode.
java.lang.IllegalArgumentException
- if the designated key is not a DH one.Registry.MAGIC_RAW_DH_PUBLIC_KEY
public java.security.PublicKey decodePublicKey(byte[] k)
IKeyPairCodec
Decodes an instance of an external public key into its native Java representation.
decodePublicKey
in interface IKeyPairCodec
k
- the source of the externalised key to decode.
public byte[] encodePrivateKey(java.security.PrivateKey key)
Returns the encoded form of the designated Diffie-Hellman private key according to the Raw format supported by this library.
The Raw format for a DH private key, in this implementation, is a byte sequence consisting of the following:
Registry.MAGIC_RAW_DH_PRIVATE_KEY
,q
,BigInteger
obtained by invoking
the toByteArray()
method on the DH parameter q
,p
in internet order,BigInteger
obtained by invoking
the toByteArray()
method on the DH parameter p
,g
,BigInteger
obtained by invoking
the toByteArray()
method on the DH parameter g
,x
,BigInteger
obtained by invoking
the toByteArray()
method on the DH parameter x
,
encodePrivateKey
in interface IKeyPairCodec
key
- the key to encode.
java.lang.IllegalArgumentException
- if the designated key is not a DH one.Registry.MAGIC_RAW_DH_PRIVATE_KEY
public java.security.PrivateKey decodePrivateKey(byte[] k)
IKeyPairCodec
Decodes an instance of an external private key into its native Java representation.
decodePrivateKey
in interface IKeyPairCodec
k
- the source of the externalised key to decode.
|
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 |