java.lang.Object
java.security.spec.SM2KeyAgreementParamSpec
- All Implemented Interfaces:
AlgorithmParameterSpec
The parameters used by SM2 key agreement.
-
Constructor Summary
ConstructorsConstructorDescriptionSM2KeyAgreementParamSpec
(byte[] id, ECPrivateKey privateKey, ECPublicKey publicKey, byte[] peerId, ECPublicKey peerPublicKey, boolean isInitiator, int sharedKeyLength) Create a newSM2KeyAgreementParamSpec
.SM2KeyAgreementParamSpec
(ECPrivateKey privateKey, ECPublicKey publicKey, ECPublicKey peerPublicKey, boolean isInitiator, int sharedKeyLength) Create a newSM2KeyAgreementParamSpec
. -
Method Summary
-
Constructor Details
-
SM2KeyAgreementParamSpec
public SM2KeyAgreementParamSpec(byte[] id, ECPrivateKey privateKey, ECPublicKey publicKey, byte[] peerId, ECPublicKey peerPublicKey, boolean isInitiator, int sharedKeyLength) Create a newSM2KeyAgreementParamSpec
.- Parameters:
id
- the ID.privateKey
- the private key.publicKey
- the public key.peerId
- the peer's ID.peerPublicKey
- the peer's public key.isInitiator
- true indicates it initiates the key exchanging; false indicates peer initiates the key exchange.sharedKeyLength
- the length of the shared key.- Throws:
NullPointerException
- any parameter is null.
-
SM2KeyAgreementParamSpec
public SM2KeyAgreementParamSpec(ECPrivateKey privateKey, ECPublicKey publicKey, ECPublicKey peerPublicKey, boolean isInitiator, int sharedKeyLength) Create a newSM2KeyAgreementParamSpec
. It just uses the default ID, exactly1234567812345678
.- Parameters:
privateKey
- the private key.publicKey
- the public key.peerPublicKey
- the peer's public key.isInitiator
- true indicates it initiates the key exchanging; false indicates peer initiates the key exchange.sharedKeyLength
- the length of the shared key.- Throws:
NullPointerException
- any parameter is null.
-
-
Method Details
-
id
public byte[] id()Returns the ID.- Returns:
- the ID.
-
privateKey
Returns the private key.- Returns:
- the private key.
-
publicKey
Returns the public key.- Returns:
- the public key.
-
peerId
public byte[] peerId()Returns the peer's ID.- Returns:
- the peer's ID.
-
peerPublicKey
Returns the peer's public key.- Returns:
- the peer's public key.
-
isInitiator
public boolean isInitiator()Indicates if it is initiator.- Returns:
- true indicates it initiates the key exchanging; false indicates peer initiates the key exchange.
-