Module java.base

Class SM2KeyAgreementParamSpec

    • Constructor Detail

      • SM2KeyAgreementParamSpec

        public SM2KeyAgreementParamSpec​(byte[] id,
                                        ECPrivateKey privateKey,
                                        ECPublicKey publicKey,
                                        byte[] peerId,
                                        ECPublicKey peerPublicKey,
                                        boolean isInitiator,
                                        int sharedKeyLength)
        Create a new SM2KeyAgreementParamSpec.
        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 new SM2KeyAgreementParamSpec. It just uses the default ID, exactly 1234567812345678.
        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.