- All Superinterfaces:
Prototype.Api
- All Known Implementing Classes:
PemKeys.BuilderBase.PemKeysImpl
PEM files based keys - accepts private key and certificate chain.
If you have "standard" linux/unix private key, you must run "
openssl pkcs8 -topk8 -in ./id_rsa -out ./id_rsa.p8
" on it to work with this builder for password protected
file; or "openssl pkcs8 -topk8 -in ./id_rsa -out ./id_rsa_nocrypt.p8 -nocrypt
" for unprotected file.
The only supported format is PKCS#8. If you have a different format, you must transform it to PKCS8 PEM format (to
use this builder), or to PKCS#12 keystore format (and use KeystoreKeys.Builder
).
- See Also:
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic class
Fluent API builder forPemKeys
.static class
PemKeys.BuilderBase<BUILDER extends PemKeys.BuilderBase<BUILDER,
PROTOTYPE>, PROTOTYPE extends PemKeys> Fluent API builder base forPemKeys
. -
Method Summary
Modifier and TypeMethodDescriptionstatic PemKeys.Builder
builder()
Create a new fluent API builder to customize configuration.static PemKeys.Builder
Create a new fluent API builder from an existing instance.Load certificate chain from PEM resource.Read one or more certificates in PEM format from a resource definition.static PemKeys
create()
Create a new instance with default values.static PemKeys
Create a new instance from configuration.key()
Read a private key from PEM format from a resource definition.Optional
<char[]> Passphrase for private key.Read a public key from PEM format from a resource definition.
-
Method Details
-
builder
Create a new fluent API builder to customize configuration.- Returns:
- a new builder
-
builder
Create a new fluent API builder from an existing instance.- Parameters:
instance
- an existing instance used as a base for the builder- Returns:
- a builder based on an instance
-
create
Create a new instance from configuration.- Parameters:
config
- used to configure the new instance- Returns:
- a new instance configured from configuration
-
create
Create a new instance with default values.- Returns:
- a new instance
-
key
Read a private key from PEM format from a resource definition.- Returns:
- key resource (file, classpath, URL etc.)
-
keyPassphrase
Optional<char[]> keyPassphrase()Passphrase for private key. If the key is encrypted (and in PEM PKCS#8 format), this passphrase will be used to decrypt it.- Returns:
- passphrase used to encrypt the private key
-
publicKey
Read a public key from PEM format from a resource definition.- Returns:
- public key resource (file, classpath, URL etc.)
-
certChain
Load certificate chain from PEM resource.- Returns:
- resource (e.g. classpath, file path, URL etc.)
-
certificates
Read one or more certificates in PEM format from a resource definition. Used eg: in a trust store.- Returns:
- key resource (file, classpath, URL etc.)
-