public final class KeyPairAttributesMap
extends java.lang.Object
implements java.security.spec.AlgorithmParameterSpec
An instance of this class may be used to uniquely configure a key pair during a key operation. Simply populate an instance using CloudHSM-supported key attributes and values. Then pass the instance as a parameter to the Cavium ParameterSpec class which corresponds to the key operation you wish to execute.
This class essentially encapsulates two KeyAttributesMap objects, one for the public
key and another for the private key.
IMPORTANT NOTE: Altering the contents of an instance of this class after the key has been inserted into the HSM will not modify the attributes or values of the key itself.
KeyAttribute,
KeyAttributesMap| Constructor and Description |
|---|
KeyPairAttributesMap()
Constructs an empty
KeyPairAttributesMap containing no key pair attributes or
values. |
KeyPairAttributesMap(KeyAttributePermissiveProfile permissiveProfile)
Constructs a new
KeyPairAttributesMap using the key pair attributes and
permissive values as specified in KeyAttributePermissiveProfile. |
KeyPairAttributesMap(KeyAttributesMap publicKeyAttributesMap,
KeyAttributesMap privateKeyAttributesMap)
Constructs a new
KeyPairAttributesMap with the same key attributes and values as
the specified KeyAttributesMap objects, one for the public key and one for the
private key. |
KeyPairAttributesMap(KeyPairAttributesMap keyPairAttributesMap)
Constructs a new
KeyPairAttributesMap with the same key pair attributes and
values as the specified KeyPairAttributesMap. |
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
getOrDefaultPrivate(KeyAttribute keyAttribute,
java.lang.Object defaultValue)
Returns the value to which the specified private key attribute is mapped, or
defaultValue if the private key map contains no mapping for the key attribute. |
java.lang.Object |
getOrDefaultPublic(KeyAttribute keyAttribute,
java.lang.Object defaultValue)
Returns the value to which the specified public key attribute is mapped, or
defaultValue if the public key map contains no mapping for the key attribute. |
KeyAttributesMap |
getPrivate()
Returns the
KeyAttributesMap associated with this key pair's private key. |
java.lang.Object |
getPrivate(KeyAttribute keyAttribute)
Returns the value to which the specified key attribute is mapped, or
null if the
key map contains no mapping for the key attribute. |
KeyAttributesMap |
getPublic()
Returns the
KeyAttributesMap associated with this key pair's public key. |
java.lang.Object |
getPublic(KeyAttribute keyAttribute)
Returns the value to which the specified key attribute is mapped, or
null if the
key map contains no mapping for the key attribute. |
void |
putAll(KeyPairAttributesMap keyPairAttributesMap)
Copies all of the mappings from the specified map to the public and private attributes maps.
|
void |
putAllPrivate(KeyAttributesMap keyAttributesMap)
Copies all mappings from the specified map to the private attributes map.
|
void |
putAllPublic(KeyAttributesMap keyAttributesMap)
Copies all mappings from the specified map to the public attributes map.
|
java.lang.Object |
putPrivate(KeyAttribute keyAttribute,
java.lang.Object value)
Associates the specified value with the specified key attribute in the private key map.
|
java.lang.Object |
putPublic(KeyAttribute keyAttribute,
java.lang.Object value)
Associates the specified value with the specified key attribute in the public key map.
|
public KeyPairAttributesMap()
KeyPairAttributesMap containing no key pair attributes or
values.public KeyPairAttributesMap(KeyPairAttributesMap keyPairAttributesMap) throws java.lang.NullPointerException, AddAttributeException
KeyPairAttributesMap with the same key pair attributes and
values as the specified KeyPairAttributesMap.keyPairAttributesMap - The KeyPairAttributesMap whose key pair attributes
and values are to be placed in this KeyPairAttributesMap.java.lang.NullPointerException - If the specified object is null.AddAttributeException - If there was a problem adding attributes from
keyPairAttributesMap.public KeyPairAttributesMap(KeyAttributesMap publicKeyAttributesMap, KeyAttributesMap privateKeyAttributesMap) throws java.lang.NullPointerException, AddAttributeException
KeyPairAttributesMap with the same key attributes and values as
the specified KeyAttributesMap objects, one for the public key and one for the
private key.publicKeyAttributesMap - The KeyAttributesMap whose key attributes and
values are to be placed in this KeyPairAttributesMap's public key map.privateKeyAttributesMap - The KeyAttributesMap whose key attributes and
values are to be placed in this KeyPairAttributesMap's private key map.java.lang.NullPointerException - If the specified object is null.AddAttributeException - If there was a problem adding attributes from
publicKeyAttributesMap or privateKeyAttributesMap.public KeyPairAttributesMap(KeyAttributePermissiveProfile permissiveProfile)
KeyPairAttributesMap using the key pair attributes and
permissive values as specified in KeyAttributePermissiveProfile.permissiveProfile - A specific KeyAttributePermissiveProfile profile whose key
pair attributes and permissive values will be used to populate a new instance of
KeyPairAttributesMap.java.lang.NullPointerException - If the specified profile is null.java.lang.UnsupportedOperationException - If the specified profile is one that cannot be
converted to this map type.public java.lang.Object getPublic(KeyAttribute keyAttribute) throws java.lang.NullPointerException
null if the
key map contains no mapping for the key attribute.
This will execute against the public key map.
keyAttribute - Public key attribute whose associated value is to be returned.null
if this map contains no mapping for the public key attribute.java.lang.NullPointerException - If the specified public key attribute is null.public java.lang.Object getPrivate(KeyAttribute keyAttribute) throws java.lang.NullPointerException
null if the
key map contains no mapping for the key attribute.
This will execute against the private key map.
keyAttribute - Private key attribute whose associated value is to be returned.null
if this map contains no mapping for the private key attribute.java.lang.NullPointerException - If the specified private key attribute is null.public java.lang.Object getOrDefaultPublic(KeyAttribute keyAttribute, java.lang.Object defaultValue) throws java.lang.NullPointerException
defaultValue if the public key map contains no mapping for the key attribute.keyAttribute - Public key attribute whose associated value is to be returned.defaultValue - The default mapping of the public key attribute.
defaultValue if this map contains no mapping for the public key attribute.java.lang.NullPointerException - If the specified public key attribute is null.public java.lang.Object getOrDefaultPrivate(KeyAttribute keyAttribute, java.lang.Object defaultValue) throws java.lang.NullPointerException
defaultValue if the private key map contains no mapping for the key attribute.keyAttribute - Private key attribute whose associated value is to be returned.defaultValue - The default mapping of the private key attribute.
defaultValue if this map contains no mapping for the private key attribute.java.lang.NullPointerException - If the specified private key attribute is null.public java.lang.Object putPublic(KeyAttribute keyAttribute, java.lang.Object value) throws java.lang.NullPointerException, AddAttributeException
If the map previously contained a mapping for the key attribute, the old value is replaced.
keyAttribute - Public key attribute with which the specified value is to be associated.value - Value to be associated with the specified public key attribute.null if
there was no mapping for the key attribute.java.lang.NullPointerException - If the specified public key attribute or value is null
.AddAttributeException - If there is a problem adding the specified attribute.public java.lang.Object putPrivate(KeyAttribute keyAttribute, java.lang.Object value) throws java.lang.NullPointerException, AddAttributeException
If the map previously contained a mapping for the key attribute, the old value is replaced.
keyAttribute - Private key attribute with which the specified value is to be associated.value - Value to be associated with the specified private key attribute.null if
there was no mapping for the key attribute.java.lang.NullPointerException - If the specified private key attribute or value is null
.AddAttributeException - If there is a problem adding the specified attribute.public void putAll(KeyPairAttributesMap keyPairAttributesMap) throws java.lang.NullPointerException, AddAttributeException
These mappings will replace any mappings that this map had for any of the public and private key attributes currently in the specified map.
keyPairAttributesMap - Key attribute mappings to be stored in this map.java.lang.NullPointerException - If the specified map is null or it contains null
key attributes or values.AddAttributeException - If there was a problem adding attributes from
keyPairAttributesMap.public void putAllPublic(KeyAttributesMap keyAttributesMap) throws java.lang.NullPointerException, AddAttributeException
These mappings will replace any mappings that this map had for any of the public key attributes currently in the specified map.
keyAttributesMap - Public key attribute mappings to be stored in this map.java.lang.NullPointerException - If the specified map is null or it contains null
public key attributes or values.AddAttributeException - If there was a problem adding attributes from the public key
map.public void putAllPrivate(KeyAttributesMap keyAttributesMap) throws java.lang.NullPointerException, AddAttributeException
These mappings will replace any mappings that this map had for any of the private key attributes currently in the specified map.
keyAttributesMap - Private key attribute mappings to be stored in this map.java.lang.NullPointerException - If the specified map is null or it contains null
nullprivate key attributes or values.AddAttributeException - If there was a problem adding attributes from the private key
map.public KeyAttributesMap getPublic()
KeyAttributesMap associated with this key pair's public key.KeyAttributesMap.public KeyAttributesMap getPrivate()
KeyAttributesMap associated with this key pair's private key.KeyAttributesMap.