public interface KeyManager
KeyManager
is used for accessing system PublicKey's or generating a HMAC Key.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
SIGNATURE_ES256
JWA algorithm name for ECDSA using P-256 and SHA-256
|
static java.lang.String |
SIGNATURE_ES384
JWA algorithm name for ECDSA using P-384 and SHA-384.
|
static java.lang.String |
SIGNATURE_ES512
JWA algorithm name for ECDSA using P-512 and SHA-512.
|
static java.lang.String |
SIGNATURE_HS256
JWA algorithm name for HMAC using SHA-256.
|
static java.lang.String |
SIGNATURE_HS384
JWA algorithm name for HMAC using SHA-384.
|
static java.lang.String |
SIGNATURE_HS512
JWA algorithm name for HMAC using SHA-512.
|
static java.lang.String |
SIGNATURE_NONE
JWA name for No digital signature or MAC performed
|
static java.lang.String |
SIGNATURE_PS256
JWA algorithm name for RSASSA-PSS using SHA-256 and MGF1 with SHA-256.
|
static java.lang.String |
SIGNATURE_PS384
JWA algorithm name for RSASSA-PSS using SHA-384 and MGF1 with SHA-384.
|
static java.lang.String |
SIGNATURE_PS512
JWA algorithm name for RSASSA-PSS using SHA-512 and MGF1 with SHA-512.
|
static java.lang.String |
SIGNATURE_RS256
JWA algorithm name for RSASSA-PKCS-v1_5 using SHA-256
|
static java.lang.String |
SIGNATURE_RS384
JWA algorithm name for RSASSA-PKCS-v1_5 using SHA-384
|
static java.lang.String |
SIGNATURE_RS512
JWA algorithm name for RSASSA-PKCS-v1_5 using SHA-512
|
Modifier and Type | Method and Description |
---|---|
javax.crypto.SecretKey |
generateAESSecretKey(byte[] secretKey)
Returns AES Secret key from the specified byte array
|
javax.crypto.SecretKey |
generateAESSecretKey(java.lang.String secretKey)
Returns AES Secret key from the specified String
|
javax.crypto.SecretKey |
generateHMACSecretKey(java.lang.String signatureAlgorthm,
byte[] secretKey)
Returns HMAC Secret Key based on the HMAC Algorithm
|
javax.crypto.SecretKey |
generateHMACSecretKey(java.lang.String signatureAlgorthm,
java.lang.String secretKey)
Returns HMAC Secret Key based on the HMAC Algorithm
|
byte[] |
generateSecretKeyBytes(int size)
Returns random bytes of a specified length using
java.security.SecureRandom |
java.security.Key |
getKeyFromKeystore(java.lang.String alias,
java.lang.String password)
Returns Key from the system key store for a given alias name and password.
|
java.security.Key |
getPublicKeyFromKeystore(java.lang.String alias)
Returns a PublicKey from the system key store for a given alias name.
|
java.security.Key |
getPublicKeyFromRemoteCerts(java.lang.String certsURL,
java.lang.String keyId)
Returns a PublicKey from a published published X509 base64 encoded certificates using the specified URL, identified by a keyId
|
java.security.Key |
getPublicKeyFromTrustore(java.lang.String alias)
Returns a PublicKey from the system trust store for a given alias name.
|
java.security.Key |
getPublicKeyFromTrustore(java.lang.String alias,
java.lang.String password)
Returns Key from the system key store for a given alias name and password.
|
static final java.lang.String SIGNATURE_NONE
static final java.lang.String SIGNATURE_ES256
static final java.lang.String SIGNATURE_ES384
static final java.lang.String SIGNATURE_ES512
static final java.lang.String SIGNATURE_HS256
static final java.lang.String SIGNATURE_HS384
static final java.lang.String SIGNATURE_HS512
static final java.lang.String SIGNATURE_PS256
static final java.lang.String SIGNATURE_PS384
static final java.lang.String SIGNATURE_PS512
static final java.lang.String SIGNATURE_RS256
static final java.lang.String SIGNATURE_RS384
static final java.lang.String SIGNATURE_RS512
java.security.Key getPublicKeyFromTrustore(java.lang.String alias) throws java.security.GeneralSecurityException, java.io.IOException
alias
- name of the key to loadjava.security.GeneralSecurityException
- if there is an problem loading the keyjava.io.IOException
- if there is a problem accessing the trust storejava.security.Key getPublicKeyFromTrustore(java.lang.String alias, java.lang.String password) throws java.security.GeneralSecurityException, java.io.IOException
alias
- name of the key to loadjava.security.GeneralSecurityException
- if there is an problem loading the keyjava.io.IOException
- if there is a problem accessing the trust storejava.security.Key getPublicKeyFromKeystore(java.lang.String alias) throws java.security.GeneralSecurityException, java.io.IOException
alias
- name of the key to loadjava.security.GeneralSecurityException
- if there is an problem loading the keyjava.io.IOException
- if there is a problem accessing the trust storejava.security.Key getKeyFromKeystore(java.lang.String alias, java.lang.String password) throws java.security.GeneralSecurityException, java.io.IOException
alias
- name of the key to loadjava.security.GeneralSecurityException
- if there is an problem loading the keyjava.io.IOException
- if there is a problem accessing the trust storejavax.crypto.SecretKey generateHMACSecretKey(java.lang.String signatureAlgorthm, java.lang.String secretKey) throws java.security.GeneralSecurityException, java.security.InvalidKeyException, java.io.UnsupportedEncodingException
signatureAlgorthm
- to usesecretKey
- to hashjava.security.GeneralSecurityException
- if there is an problem generating the keyjava.security.InvalidKeyException
- if there is a problem generating the keyjava.io.UnsupportedEncodingException
SIGNATURE_HS256
,
SIGNATURE_HS384
,
SIGNATURE_HS512
javax.crypto.SecretKey generateHMACSecretKey(java.lang.String signatureAlgorthm, byte[] secretKey) throws java.security.GeneralSecurityException, java.security.InvalidKeyException
signatureAlgorthm
- to usesecretKey
- array secretKey to hashjava.security.GeneralSecurityException
- if there is an problem generating the keyjava.security.InvalidKeyException
- if there is a problem generating the keySIGNATURE_HS256
,
SIGNATURE_HS384
,
SIGNATURE_HS512
java.security.Key getPublicKeyFromRemoteCerts(java.lang.String certsURL, java.lang.String keyId) throws java.security.GeneralSecurityException, java.io.IOException
certsURL
- URL to the published certificatekeyId
- of the key to loadjava.security.GeneralSecurityException
- if there is an problem loading the keyjava.io.IOException
- if there is a problem accessing the trust storejavax.crypto.SecretKey generateAESSecretKey(byte[] secretKey) throws java.security.InvalidKeyException
secretKey
- byte array containing the secretKey to hashjava.security.InvalidKeyException
- if there is a problem generating the keyjavax.crypto.SecretKey generateAESSecretKey(java.lang.String secretKey) throws java.security.InvalidKeyException
secretKey
- Stringjava.security.InvalidKeyException
- if there is a problem generating the keybyte[] generateSecretKeyBytes(int size)
java.security.SecureRandom
size
- to use