Package software.amazon.awssdk.crt.io
Class TlsContextPkcs11Options
- java.lang.Object
-
- software.amazon.awssdk.crt.CrtResource
-
- software.amazon.awssdk.crt.io.TlsContextPkcs11Options
-
- All Implemented Interfaces:
AutoCloseable
public class TlsContextPkcs11Options extends CrtResource
Options for TLS using a PKCS#11 library for private key operations.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class software.amazon.awssdk.crt.CrtResource
CrtResource.ResourceInstance
-
-
Constructor Summary
Constructors Constructor Description TlsContextPkcs11Options(Pkcs11Lib pkcs11Lib)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
canReleaseReferencesImmediately()
Override that determines whether a resource releases its dependencies at the same time the native handle is released or if it waits.protected void
releaseNativeHandle()
Required override method that must begin the release process of the acquired native handleTlsContextPkcs11Options
withCertificateFileContents(String contents)
Use this X.509 certificate (contents in memory).TlsContextPkcs11Options
withCertificateFilePath(String path)
Use this X.509 certificate (file on disk).TlsContextPkcs11Options
withPrivateKeyObjectLabel(String label)
Specify the label of the private key object on the PKCS#11 token.TlsContextPkcs11Options
withSlotId(long slotId)
Specify the slot ID containing a PKCS#11 token.TlsContextPkcs11Options
withTokenLabel(String label)
Specify the label of the PKCS#11 token to use.TlsContextPkcs11Options
withUserPin(String pin)
Use this PIN to log the user into the PKCS#11 token.-
Methods inherited from class software.amazon.awssdk.crt.CrtResource
acquireNativeHandle, addRef, addReferenceTo, close, collectNativeResource, collectNativeResources, decRef, getNativeHandle, getResourceLogDescription, isNull, logNativeResources, releaseReferences, removeReferenceTo, setDescription, swapReferenceTo, waitForNoResources
-
-
-
-
Constructor Detail
-
TlsContextPkcs11Options
public TlsContextPkcs11Options(Pkcs11Lib pkcs11Lib)
Constructor- Parameters:
pkcs11Lib
- use this PKCS#11 library
-
-
Method Detail
-
withUserPin
public TlsContextPkcs11Options withUserPin(String pin)
Use this PIN to log the user into the PKCS#11 token. Leave unspecified to log into a token with a "protected authentication path".- Parameters:
pin
- PIN- Returns:
- this
-
withSlotId
public TlsContextPkcs11Options withSlotId(long slotId)
Specify the slot ID containing a PKCS#11 token. If not specified, the token will be chosen based on other criteria (such as token label).- Parameters:
slotId
- slot ID- Returns:
- this
-
withTokenLabel
public TlsContextPkcs11Options withTokenLabel(String label)
Specify the label of the PKCS#11 token to use. If not specified, the token will be chosen based on other criteria (such as slot ID).- Parameters:
label
- label of token- Returns:
- this
-
withPrivateKeyObjectLabel
public TlsContextPkcs11Options withPrivateKeyObjectLabel(String label)
Specify the label of the private key object on the PKCS#11 token. If not specified, the key will be chosen based on other criteria (such as being the only available private key on the token).- Parameters:
label
- label of private key object- Returns:
- this
-
withCertificateFilePath
public TlsContextPkcs11Options withCertificateFilePath(String path)
Use this X.509 certificate (file on disk). The certificate may be specified by other means instead (ex:withCertificateFileContents(java.lang.String)
)- Parameters:
path
- path to PEM-formatted certificate file on disk.- Returns:
- this
-
withCertificateFileContents
public TlsContextPkcs11Options withCertificateFileContents(String contents)
Use this X.509 certificate (contents in memory). The certificate may be specified by other means instead (ex:withCertificateFilePath(java.lang.String)
)- Parameters:
contents
- contents of PEM-formatted certificate file.- Returns:
- this
-
releaseNativeHandle
protected void releaseNativeHandle()
Description copied from class:CrtResource
Required override method that must begin the release process of the acquired native handle- Specified by:
releaseNativeHandle
in classCrtResource
-
canReleaseReferencesImmediately
protected boolean canReleaseReferencesImmediately()
Description copied from class:CrtResource
Override that determines whether a resource releases its dependencies at the same time the native handle is released or if it waits. Resources with asynchronous shutdown processes should override this with false, and establish a callback from native code that invokes releaseReferences() when the asynchronous shutdown process has completed. See HttpClientConnectionManager for an example.- Specified by:
canReleaseReferencesImmediately
in classCrtResource
- Returns:
- true if this resource releases synchronously, false if this resource performs async shutdown
-
-