public DeriveSharedSecretRequest withPublicKey(java.nio.ByteBuffer publicKey) {
        setPublicKey(publicKey);
        return this;
    }
<p>
Specifies the public key in your peer's NIST-recommended elliptic curve (ECC) or SM2 (China Regions only) key
pair.
</p>
<p>
The public key must be a DER-encoded X.509 public key, also known as <code>SubjectPublicKeyInfo</code> (SPKI), as
defined in <a href="https://tools.ietf.org/html/rfc5280">RFC 5280</a>.
</p>
<p>
<a>GetPublicKey</a> returns the public key of an asymmetric KMS key pair in the required DER-encoded format.
</p>
<note>
<p>
If you use <a href="https://docs.aws.amazon.com/cli/v1/userguide/cli-chap-welcome.html">Amazon Web Services CLI
version 1</a>, you must provide the DER-encoded X.509 public key in a file. Otherwise, the Amazon Web Services
CLI Base64-encodes the public key a second time, resulting in a <code>ValidationException</code>.
</p>
</note>
<p>
You can specify the public key as binary data in a file using fileb (<code>fileb://&lt;path-to-file&gt;</code>)
or in-line using a Base64 encoded string.
</p>
<p>
The AWS SDK for Java performs a Base64 encoding on this field before sending this request to the AWS service.
Users of the SDK should not perform Base64 encoding on this field.
</p>
<p>
Warning: ByteBuffers returned by the SDK are mutable. Changes to the content or position of the byte buffer will
be seen by all objects that have a reference to this object. It is recommended to call ByteBuffer.duplicate() or
ByteBuffer.asReadOnlyBuffer() before using or reading from the buffer. This behavior will be changed in a future
major version of the SDK.
</p>

@param publicKey
       Specifies the public key in your peer's NIST-recommended elliptic curve (ECC) or SM2 (China Regions only)
       key pair.</p>
       <p>
       The public key must be a DER-encoded X.509 public key, also known as <code>SubjectPublicKeyInfo</code>
       (SPKI), as defined in <a href="https://tools.ietf.org/html/rfc5280">RFC 5280</a>.
       </p>
       <p>
       <a>GetPublicKey</a> returns the public key of an asymmetric KMS key pair in the required DER-encoded
       format.
       </p>
       <note>
       <p>
       If you use <a href="https://docs.aws.amazon.com/cli/v1/userguide/cli-chap-welcome.html">Amazon Web
       Services CLI version 1</a>, you must provide the DER-encoded X.509 public key in a file. Otherwise, the
       Amazon Web Services CLI Base64-encodes the public key a second time, resulting in a
       <code>ValidationException</code>.
       </p>
       </note>
       <p>
       You can specify the public key as binary data in a file using fileb (
       <code>fileb://&lt;path-to-file&gt;</code>) or in-line using a Base64 encoded string.
@return Returns a reference to this object so that method calls can be chained together.
aws-java-sdk-kms/src/main/java/com/amazonaws/services/kms/model/DeriveSharedSecretRequest.java