AdvancedMultiPskStore instead.@Deprecated public class InMemoryPskStore extends Object implements PskStore
If you don't need to initiate handshake/connection, you could just add
identity/key with setKey(String, byte[]) or
setKey(PskPublicInformation, byte[]). If you need to initiate
connection, you should add known peers with
addKnownPeer(InetSocketAddress, String, byte[]) or
addKnownPeer(InetSocketAddress, PskPublicInformation, byte[]).
If non-compliant encoded identities are used, please provide
PskPublicInformation.PskPublicInformation(String, byte[]) identities
with the non-compliant encoded bytes and the intended string.
To be used only for testing and evaluation. You are supposed to store your key in a secure way: keeping them in-memory is not a good idea.
| Constructor and Description |
|---|
InMemoryPskStore()
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addKnownPeer(InetSocketAddress peerAddress,
PskPublicInformation identity,
byte[] key)
Deprecated.
Adds a shared key for a peer.
|
void |
addKnownPeer(InetSocketAddress peerAddress,
String identity,
byte[] key)
Deprecated.
Adds a shared key for a peer.
|
void |
addKnownPeer(InetSocketAddress peerAddress,
String virtualHost,
PskPublicInformation identity,
byte[] key)
Deprecated.
Adds a shared key for a virtual host on a peer.
|
void |
addKnownPeer(InetSocketAddress peerAddress,
String virtualHost,
String identity,
byte[] key)
Deprecated.
Adds a shared key for a virtual host on a peer.
|
PskPublicInformation |
getIdentity(InetSocketAddress peerAddress)
Deprecated.
Gets the identity to use for a PSK based handshake with a given
peer.
|
PskPublicInformation |
getIdentity(InetSocketAddress peerAddress,
ServerNames virtualHost)
Deprecated.
Gets the identity to use for a PSK based handshake with a given
peer.
|
SecretKey |
getKey(PskPublicInformation identity)
Deprecated.
Gets the pre-shared key for a given identity.
|
SecretKey |
getKey(ServerNames serverNames,
PskPublicInformation identity)
Deprecated.
Gets the pre-shared key for a given identity in the scope of a server
name.
|
void |
removeKey(PskPublicInformation identity)
Deprecated.
Removes a key value for a given identity.
|
void |
removeKey(PskPublicInformation identity,
ServerName virtualHost)
Deprecated.
Removes a key for an identity scoped to a virtual host.
|
void |
removeKey(PskPublicInformation identity,
String virtualHost)
Deprecated.
Removes a key for an identity scoped to a virtual host.
|
void |
removeKey(String identity)
Deprecated.
Removes a key value for a given identity.
|
void |
removeKey(String identity,
ServerName virtualHost)
Deprecated.
Removes a key for an identity scoped to a virtual host.
|
void |
removeKey(String identity,
String virtualHost)
Deprecated.
Removes a key for an identity scoped to a virtual host.
|
void |
setKey(PskPublicInformation identity,
byte[] key)
Deprecated.
Sets a key value for a given identity.
|
void |
setKey(PskPublicInformation identity,
byte[] key,
ServerName virtualHost)
Deprecated.
Sets a key for an identity scoped to a virtual host.
|
void |
setKey(PskPublicInformation identity,
byte[] key,
String virtualHost)
Deprecated.
Sets a key for an identity scoped to a virtual host.
|
void |
setKey(String identity,
byte[] key)
Deprecated.
Sets a key value for a given identity.
|
void |
setKey(String identity,
byte[] key,
ServerName virtualHost)
Deprecated.
Sets a key for an identity scoped to a virtual host.
|
void |
setKey(String identity,
byte[] key,
String virtualHost)
Deprecated.
Sets a key for an identity scoped to a virtual host.
|
public SecretKey getKey(PskPublicInformation identity)
PskStoreA DTLS server can use this method to look up the pre-shared key for an identity provided by the client as part of a PSK key exchange.
The implementation is intended to normalize the identity by a matching entry, if that entry is not UTF-8 compliant encoded.
The returned key isSecretUtil.destroy(javax.crypto.SecretKey)ed after usage.getKey in interface PskStoreidentity - The identity to look up the key for.null if the given identity is unknown.PskPublicInformation.normalize(String)public SecretKey getKey(ServerNames serverNames, PskPublicInformation identity)
PskStoreA DTLS server can use this method to look up the pre-shared key for an identity provided by the client as part of a PSK key exchange.
The key is looked up in the context of the virtual host that the client has provided in the Server Name Indication extension contained in its CLIENT_HELLO message.
The implementation is intended to normalize the identity by a matching entry, if that entry is not UTF-8 compliant encoded.
The returned key is intended to be be a copy. If the usedSecretKey implements Destroyable, it will be cleaned up
by SecretUtil.destroy(javax.crypto.SecretKey)ed after its usage.getKey in interface PskStoreserverNames - The name of the host that the client wants to connect
to as provided in the Server Name Indication HELLO
extension during the DTLS handshake. The key returned for the
given identity is being looked up in the context of this host
name.identity - The identity to look up the key for.null if no matching identity has been
registered for any of the server name types.PskPublicInformation.normalize(String)public void setKey(String identity, byte[] key)
If the key already exists, it will be replaced.
identity - the identity associated with the keykey - the key used to authenticate the identitysetKey(PskPublicInformation, byte[], ServerName)public void setKey(PskPublicInformation identity, byte[] key)
If the key already exists, it will be replaced.
identity - the identity associated with the keykey - the key used to authenticate the identitysetKey(PskPublicInformation, byte[], ServerName)public void setKey(String identity, byte[] key, String virtualHost)
If the key already exists, it will be replaced.
identity - The identity to set the key for.key - The key to set for the identity.virtualHost - The virtual host to associate the identity and key
with.setKey(PskPublicInformation, byte[], ServerName)public void setKey(PskPublicInformation identity, byte[] key, String virtualHost)
If the key already exists, it will be replaced.
identity - The identity to set the key for.key - The key to set for the identity.virtualHost - The virtual host to associate the identity and key
with.setKey(PskPublicInformation, byte[], ServerName)public void setKey(String identity, byte[] key, ServerName virtualHost)
If the key already exists, it will be replaced.
identity - The identity to set the key for.key - The key to set for the identity.virtualHost - The virtual host to associate the identity and key
with.setKey(PskPublicInformation, byte[], ServerName)public void setKey(PskPublicInformation identity, byte[] key, ServerName virtualHost)
If the key already exists, it will be replaced.
identity - The identity to set the key for.key - The key to set for the identity.virtualHost - The virtual host to associate the identity and key
with.setKey(String, byte[], ServerName)public void addKnownPeer(InetSocketAddress peerAddress, String identity, byte[] key)
If the key already exists, it will be replaced.
peerAddress - the IP address and port to use the key foridentity - the PSK identitykey - the shared keyNullPointerException - if any of the parameters are null.addKnownPeer(InetSocketAddress, PskPublicInformation, byte[])public void addKnownPeer(InetSocketAddress peerAddress, PskPublicInformation identity, byte[] key)
If the key already exists, it will be replaced.
peerAddress - the IP address and port to use the key foridentity - the PSK identitykey - the shared keyNullPointerException - if any of the parameters are null.addKnownPeer(InetSocketAddress, String, byte[])public void addKnownPeer(InetSocketAddress peerAddress, String virtualHost, String identity, byte[] key)
If the key already exists, it will be replaced. serverNames
peerAddress - the IP address and port to use the key forvirtualHost - the virtual host to use the key foridentity - the PSK identitykey - the shared keyNullPointerException - if any of the parameters are null.addKnownPeer(InetSocketAddress, String, PskPublicInformation,
byte[])public void addKnownPeer(InetSocketAddress peerAddress, String virtualHost, PskPublicInformation identity, byte[] key)
If the key already exists, it will be replaced. serverNames
peerAddress - the IP address and port to use the key forvirtualHost - the virtual host to use the key foridentity - the PSK identitykey - the shared keyNullPointerException - if any of the parameters are null.addKnownPeer(InetSocketAddress, String, String, byte[])public void removeKey(String identity)
identity - The identity to remove the key for.removeKey(PskPublicInformation, ServerName)public void removeKey(PskPublicInformation identity)
identity - The identity to remove the key for.removeKey(PskPublicInformation, ServerName)public void removeKey(String identity, String virtualHost)
identity - The identity to remove the key for.virtualHost - The virtual host to associate the identity and key
with.removeKey(PskPublicInformation, ServerName)public void removeKey(PskPublicInformation identity, String virtualHost)
identity - The identity to remove the key for.virtualHost - The virtual host to associate the identity and key
with.removeKey(PskPublicInformation, ServerName)public void removeKey(String identity, ServerName virtualHost)
identity - The identity to remove the key for.virtualHost - The virtual host to associate the identity with.removeKey(PskPublicInformation, ServerName)public void removeKey(PskPublicInformation identity, ServerName virtualHost)
identity - The identity to remove the key for.virtualHost - The virtual host to associate the identity with.public PskPublicInformation getIdentity(InetSocketAddress peerAddress)
PskStoreA DTLS client uses this method to determine the identity to include in its CLIENT_KEY_EXCHANGE message during a PSK based DTLS handshake with the peer.
getIdentity in interface PskStorepeerAddress - The IP address of the peer to perform the handshake
with.null if no peer with the given
address is registered.public PskPublicInformation getIdentity(InetSocketAddress peerAddress, ServerNames virtualHost)
PskStoreA DTLS client uses this method to determine the identity to include in its CLIENT_KEY_EXCHANGE message during a PSK based DTLS handshake with the peer.
getIdentity in interface PskStorepeerAddress - The IP address and port of the peer to perform the
handshake with.virtualHost - The virtual host at the peer to connect to. If
null, the identity will be looked up in the
global scope, yielding the same result as
PskStore.getIdentity(InetSocketAddress).null if no peer with the given
address and virtual host is registered.Copyright © 2023 Eclipse Foundation. All rights reserved.