public class OneKey extends Object
| Modifier and Type | Field and Description |
|---|---|
protected com.upokecenter.cbor.CBORObject |
keyMap |
| Constructor and Description |
|---|
OneKey() |
OneKey(com.upokecenter.cbor.CBORObject keyData) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(com.upokecenter.cbor.CBORObject keyValue,
com.upokecenter.cbor.CBORObject value) |
void |
add(KeyKeys keyValue,
com.upokecenter.cbor.CBORObject value) |
com.upokecenter.cbor.CBORObject |
AsCBOR()
Return the key as a CBOR object
|
PrivateKey |
AsPrivateKey()
Return a java.security.PrivateKey that is the same as the OneKey key
|
PublicKey |
AsPublicKey()
Return a java.security.PublicKey that is the same as the OneKey key
|
byte[] |
EncodeToBytes()
Encode to a byte string
|
static OneKey |
generateKey(AlgorithmID algorithm) |
static OneKey |
generateKey(com.upokecenter.cbor.CBORObject curve) |
com.upokecenter.cbor.CBORObject |
get(com.upokecenter.cbor.CBORObject keyValue) |
com.upokecenter.cbor.CBORObject |
get(KeyKeys keyValue) |
ECGenParameterSpec |
GetCurve2() |
Object |
getUserData()
Return the user data field.
|
boolean |
HasAlgorithmID(AlgorithmID algorithmId)
Compares the key's assigned algorithm with the provided value, indicating if the values are the
same.
|
boolean |
HasKeyID(String id)
Compares the key's assigned identifier with the provided value, indicating if the values are
the same.
|
boolean |
HasKeyOp(Integer that)
Compares the key's assigned key operations with the provided value, indicating if the provided
value was found in the key operation values assigned to the key.
|
boolean |
HasKeyType(com.upokecenter.cbor.CBORObject keyTypeObj)
Compares the key's assigned key type with the provided value, indicating if the values are the
same.
|
OneKey |
PublicKey()
Create a OneKey object with only the public fields.
|
void |
setUserData(Object newData)
Set the user data field.
|
public OneKey()
public OneKey(com.upokecenter.cbor.CBORObject keyData)
throws CoseException
CoseExceptionpublic void add(KeyKeys keyValue, com.upokecenter.cbor.CBORObject value)
public void add(com.upokecenter.cbor.CBORObject keyValue,
com.upokecenter.cbor.CBORObject value)
public com.upokecenter.cbor.CBORObject get(KeyKeys keyValue)
public com.upokecenter.cbor.CBORObject get(com.upokecenter.cbor.CBORObject keyValue)
throws CoseException
CoseExceptionpublic boolean HasAlgorithmID(AlgorithmID algorithmId)
algorithmId - the algorithm to compare or null to check for no assignment.true if the current key has the provided algorithm assigned, or false
otherwisepublic boolean HasKeyID(String id)
id - the identifier to compare or null to check for no assignment.true if the current key has the provided identifier assigned, or false
otherwisepublic boolean HasKeyType(com.upokecenter.cbor.CBORObject keyTypeObj)
keyTypeObj - the key type to compare or null to check for no assignment.true if the current key has the provided identifier assigned, or false
otherwisepublic boolean HasKeyOp(Integer that)
that - the integer operation value to attempt to find in the values provided by the key or
null to check for no assignment.true if the current key has the provided value assigned, or false
otherwisepublic ECGenParameterSpec GetCurve2() throws CoseException
CoseExceptionpublic static OneKey generateKey(AlgorithmID algorithm) throws CoseException
CoseExceptionpublic static OneKey generateKey(com.upokecenter.cbor.CBORObject curve) throws CoseException
CoseExceptionpublic OneKey PublicKey()
public byte[] EncodeToBytes()
public com.upokecenter.cbor.CBORObject AsCBOR()
public PublicKey AsPublicKey() throws CoseException
CoseException - If there is a conversion errorpublic PrivateKey AsPrivateKey() throws CoseException
CoseException - if there is a conversion errorpublic Object getUserData()
public void setUserData(Object newData)
newData - Data field to be saved.COSE for Java documentation, generatedin 2018.