Interface X509IdentitySource
- All Known Implementing Classes:
PasswordProtectedKeyStoreIdentitySource,PEMIdentitySource
public interface X509IdentitySource
Provides a source for loading an
X509Identity from some underlying key and certificate.
These sources should keep track of the last time an identity was loaded along with the earliest
expiration date of any contained certificates. These identities may be adapted into refreshable
identities via refreshable(Duration) which specifies a polling duration in which to
recheck if the identity should be reloaded.-
Method Summary
Modifier and TypeMethodDescriptionstatic X509IdentitySourcefromKeyStore(Path keystoreFile, String keystoreType, PasswordProvider passwordProvider) Creates an identity source from a password-protectedKeyStorefile.static X509IdentitySourcefromKeyStore(Path keystoreFile, String keystoreType, PasswordProvider keystorePasswordProvider, PasswordProvider privateKeyPasswordProvider) Creates an identity source from a password-protectedKeyStorefile.static X509IdentitySourceCreates an identity source from a PEM-encoded private key file and certificate file.static X509IdentitySourcefromPKCS12(Path keystoreFile, PasswordProvider passwordProvider) Creates an identity source from a PKCS#12-encoded keystore file and password provider function.static X509IdentitySourcefromPKCS12(Path keystoreFile, PasswordProvider keystorePasswordProvider, PasswordProvider privateKeyPasswordProvider) Creates an identity source from a PKCS#12-encoded keystore file, keystore password provider function, and identity private key password provider function.Returns the earliest date and time of expiration of the certificates included in this source.Returns the time this source last loaded an identity.Returns the time that the key or certificate source was last modified.load()Loads anX509Identityfrom this underlying source.default X509Identityrefreshable(Duration refreshCheckDelay) Creates a refreshableX509Identityfrom this source and the given refresh check delay.
-
Method Details
-
getLastLoaded
Instant getLastLoaded()Returns the time this source last loaded an identity. This may returnInstant.MINif no identity has been loaded yet. -
getLastModified
Instant getLastModified()Returns the time that the key or certificate source was last modified. -
getExpiresAt
Instant getExpiresAt()Returns the earliest date and time of expiration of the certificates included in this source. This may returnInstant.MAXif no expiration date is known. -
load
Loads anX509Identityfrom this underlying source. Any thrownGeneralSecurityExceptioninstances should be rethrown in aNestedSecurityIOException.- Throws:
IOException
-
refreshable
Creates a refreshableX509Identityfrom this source and the given refresh check delay. The returned identity will periodically check if a reload is required based on the last modified timestamp of the source along with the expiration of the certificates.- See Also:
-
fromPEM
Creates an identity source from a PEM-encoded private key file and certificate file. -
fromPKCS12
Creates an identity source from a PKCS#12-encoded keystore file and password provider function. -
fromPKCS12
static X509IdentitySource fromPKCS12(Path keystoreFile, PasswordProvider keystorePasswordProvider, PasswordProvider privateKeyPasswordProvider) Creates an identity source from a PKCS#12-encoded keystore file, keystore password provider function, and identity private key password provider function. -
fromKeyStore
static X509IdentitySource fromKeyStore(Path keystoreFile, String keystoreType, PasswordProvider passwordProvider) Creates an identity source from a password-protectedKeyStorefile. -
fromKeyStore
static X509IdentitySource fromKeyStore(Path keystoreFile, String keystoreType, PasswordProvider keystorePasswordProvider, PasswordProvider privateKeyPasswordProvider) Creates an identity source from a password-protectedKeyStorefile.- Parameters:
keystoreFile- path to the keystore file to readkeystoreType- the type of the keystore (typicallyPKCS12)keystorePasswordProvider- function for obtaining the password to decrypt the keystore fileprivateKeyPasswordProvider- function for obtaining the password to decrypt the identity private key (this is typically the same as the keystore password)- Returns:
- an identity source from the provided keystore details
-