public interface KeyReader
Provide methods to read public and private security keys from different sources, using the KeySource
interface to support several key sources, and with different key formats and encodings.
Modifier and Type | Field and Description |
---|---|
static String |
PARAMETER_KEYSTORE_KEY_ALIAS
Parameter which can be used when reading a key from a Key Store to provide the key alias name in the Key Store
|
static String |
PARAMETER_KEYSTORE_KEY_PASSWORD
Parameter which can be used when reading a key from a Key Store to provide the key recovering password for a key
alias
|
static String |
PARAMETER_KEYSTORE_PASSWORD
Parameter which can be used when reading a key from a Key Store to provide the Key Store password
|
Modifier and Type | Method and Description |
---|---|
static KeyReader |
getDefault()
Get the default
KeyReader . |
PrivateKey |
privateKey(KeySource source,
String algorithm,
KeyFormat format,
KeyEncoding encoding,
Map<String,String> parameters)
Read a
PrivateKey from given key source . |
PublicKey |
publicKey(KeySource source,
String algorithm,
KeyFormat format,
KeyEncoding encoding,
Map<String,String> parameters)
Read a
PublicKey from given key source . |
static final String PARAMETER_KEYSTORE_PASSWORD
static final String PARAMETER_KEYSTORE_KEY_ALIAS
static final String PARAMETER_KEYSTORE_KEY_PASSWORD
PublicKey publicKey(KeySource source, String algorithm, KeyFormat format, KeyEncoding encoding, Map<String,String> parameters) throws SecurityException
PublicKey
from given key source
.
When a key store type format is used (such as KeyFormat.PKCS12
), the standard
PARAMETER_KEYSTORE_PASSWORD
, PARAMETER_KEYSTORE_KEY_ALIAS
and
PARAMETER_KEYSTORE_KEY_PASSWORD
parameters must be provided to specify the key store password, the key
alias name and the optional key recovering password.
source
- Key source (not null)algorithm
- Key algorithm. Must be a supported key factory algorithm, see
KeyFactory.getInstance(String)
(not null)format
- Key format (not null)encoding
- Key source encoding (not null)parameters
- Optional parametersPublicKey
representation of the decoded keySecurityException
- If the key source is not valid or a decoding error occurredPrivateKey privateKey(KeySource source, String algorithm, KeyFormat format, KeyEncoding encoding, Map<String,String> parameters) throws SecurityException
PrivateKey
from given key source
.
When a key store type format is used (such as KeyFormat.PKCS12
), the standard
PARAMETER_KEYSTORE_PASSWORD
, PARAMETER_KEYSTORE_KEY_ALIAS
and
PARAMETER_KEYSTORE_KEY_PASSWORD
parameters must be provided to specify the key store password, the key
alias name and the optional key recovering password.
source
- Key source (not null)algorithm
- Key algorithm. Must be a supported key factory algorithm, see
KeyFactory.getInstance(String)
(not null)format
- Key format (not null)encoding
- Key source encoding (not null)parameters
- Optional parametersPrivateKey
representation of the decoded keySecurityException
- If the key source is not valid or a decoding error occurredCopyright © 2019 The Holon Platform. All rights reserved.