- java.lang.Object
-
- java.security.spec.SM2KeyAgreementParamSpec
-
- All Implemented Interfaces:
AlgorithmParameterSpec
public final class SM2KeyAgreementParamSpec extends Object implements AlgorithmParameterSpec
The parameters used by SM2 key agreement.
-
-
Constructor Summary
Constructors Constructor Description SM2KeyAgreementParamSpec(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]id()Returns the ID.booleanisInitiator()Indicates if it is initiator.byte[]peerId()Returns the peer's ID.ECPublicKeypeerPublicKey()Returns the peer's public key.ECPrivateKeyprivateKey()Returns the private key.ECPublicKeypublicKey()Returns the public key.intsharedKeyLength()Returns the length of the shared key.
-
-
-
Constructor Detail
-
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 Detail
-
id
public byte[] id()
Returns the ID.- Returns:
- the ID.
-
privateKey
public ECPrivateKey privateKey()
Returns the private key.- Returns:
- the private key.
-
publicKey
public ECPublicKey publicKey()
Returns the public key.- Returns:
- the public key.
-
peerId
public byte[] peerId()
Returns the peer's ID.- Returns:
- the peer's ID.
-
peerPublicKey
public ECPublicKey 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.
-
sharedKeyLength
public int sharedKeyLength()
Returns the length of the shared key.- Returns:
- the length of the shared key.
-
-