public class SingletonKeyProvider extends Object implements KeyProvider
KeyProvider
that holds a single key.KeyProvider.Tuple
Modifier and Type | Method and Description |
---|---|
KeyProvider.Tuple |
currentKey()
Gets the current key to use for signature or encryption operations.
|
Optional<Key> |
retrieveKey(String id)
Retrieves the singleton key.
|
static SingletonKeyProvider |
with(Key key)
Creates a new instance using the specified key.
|
static SingletonKeyProvider |
with(String id,
Key key)
Creates a new instance using the specified key.
|
public static SingletonKeyProvider with(Key key)
key
- the subject keypublic static SingletonKeyProvider with(String id, Key key)
id
- key identifierkey
- the subject keypublic KeyProvider.Tuple currentKey()
currentKey
in interface KeyProvider
public Optional<Key> retrieveKey(String id)
retrieveKey
in interface KeyProvider
id
- ID of the key to retrieveid
parameter is null or if the singleton key has
no identifier, the return value is the singleton key. Otherwise, the
return value is the singleton key if the specified id
equals
the ID of the singleton key, or empty if the IDs do not match.Copyright © 2019. All rights reserved.