public abstract class EncryptCommon extends Message
| Modifier and Type | Field and Description |
|---|---|
protected String |
context |
static int |
DO_NOT_SEND
Used to place an attribute in the do not send attribute map
Attributes in this map are available for lookup and use but will not
be transmitted as part of the message.
|
static int |
DontSendAttributes
Deprecated.
As of COSE 0.9.1, use Attribute.DO_NOT_SEND
|
protected byte[] |
externalData
Holder for the external data object that is authenticated as part of the
message
|
protected com.upokecenter.cbor.CBORObject |
objDontSend
Internal map of attributes which are not a part of the encoded message.
|
protected com.upokecenter.cbor.CBORObject |
objProtected
Internal map of protected attributes
|
protected com.upokecenter.cbor.CBORObject |
objUnprotected
Internal map of unprotected attributes
|
static int |
PROTECTED
Used to place an attribute in the protected attribute map
Attributes placed in this map are part of the integrity check if the cryptographic algorithm supports authenticated data.
|
static int |
ProtectedAttributes
Deprecated.
As of COSE 0.9.1, use Attribute.PROTECT
|
protected byte[] |
rgbEncrypt |
protected byte[] |
rgbProtected
The encoded byte string for the protected attributes.
|
static int |
UNPROTECTED
Used to place an attribute in the unprotected attribute map
Attributes placed in this map are not integrity protected.
|
static int |
UnprotectedAttributes
Deprecated.
As of COSE 0.9.1, use Attribute.UNPROTECT
|
emitContent, emitTag, messageTag, rgbContent| Constructor and Description |
|---|
EncryptCommon() |
| Modifier and Type | Method and Description |
|---|---|
void |
addAttribute(com.upokecenter.cbor.CBORObject label,
com.upokecenter.cbor.CBORObject value,
int where)
Set an attribute in the COSE object.
|
void |
addAttribute(HeaderKeys label,
byte[] value,
int where)
Set an attribute in the COSE object.
|
void |
addAttribute(HeaderKeys label,
com.upokecenter.cbor.CBORObject value,
int where)
Set an attribute in the COSE object.
|
void |
AddProtected(com.upokecenter.cbor.CBORObject label,
com.upokecenter.cbor.CBORObject value)
Deprecated.
As of COSE 0.9.0, use addAttribute(CBORObject, CBORObject, Attribute.PROTECTED);
|
void |
AddProtected(HeaderKeys label,
byte[] value)
Deprecated.
As of COSE 0.9.0, use addAttribute(HeaderKeys, byte[], Attribute.PROTECTED);
|
void |
AddProtected(HeaderKeys label,
com.upokecenter.cbor.CBORObject value)
Deprecated.
As of COSE 0.9.0, use addAttribute(HeaderKeys, CBORObject, Attribute.PROTECTED);
|
void |
AddUnprotected(com.upokecenter.cbor.CBORObject label,
com.upokecenter.cbor.CBORObject value)
Deprecated.
As of COSE 0.9.1, use addAttribute(HeaderKeys, byte[], Attribute.UNPROTECTED);
|
void |
AddUnprotected(HeaderKeys label,
byte[] value)
Deprecated.
As of COSE 0.9.1, use addAttribute(HeaderKeys, byte[], Attribute.UNPROTECTED);
|
void |
AddUnprotected(HeaderKeys label,
com.upokecenter.cbor.CBORObject value)
Deprecated.
As of COSE 0.9.1, use addAttribute(HeaderKeys, byte[], Attribute.UNPROTECTED);
|
protected byte[] |
decryptWithKey(byte[] rgbKey) |
com.upokecenter.cbor.CBORObject |
findAttribute(com.upokecenter.cbor.CBORObject label)
Locate an attribute in one of the attribute buckets The buckets are
searched in the order protected, unprotected, unsent.
|
com.upokecenter.cbor.CBORObject |
findAttribute(com.upokecenter.cbor.CBORObject label,
int where)
Locate an attribute in one of the attribute buckets The buckets are
searched in the order protected, unprotected, unsent.
|
com.upokecenter.cbor.CBORObject |
findAttribute(HeaderKeys label)
Locate an attribute in one of the attribute buckets The buckets are
searched in the order protected, unprotected, unsent.
|
com.upokecenter.cbor.CBORObject |
findAttribute(HeaderKeys label,
int where)
Locate an attribute in one of the attribute buckets The buckets are
searched in the order protected, unprotected, unsent.
|
com.upokecenter.cbor.CBORObject |
getDoNotSendAttributes()
Return the entire map of do not send attributes
|
byte[] |
getEncryptedContent()
Used to obtain the encrypted content for the cases where detached content
is requested.
|
byte[] |
getExternal()
Get the optional external data field to be authenticated
* @return external authenticated data
|
com.upokecenter.cbor.CBORObject |
getProtectedAttributes()
Return the entire map of protected attributes
|
com.upokecenter.cbor.CBORObject |
getUnprotectedAttributes()
Return the entire map of unprotected attributes
|
void |
removeAttribute(com.upokecenter.cbor.CBORObject label)
Remove an attribute from the set of all attribute maps.
|
void |
removeAttribute(HeaderKeys label)
Remove an attribute from the set of all attribute maps.
|
void |
setEncryptedContent(byte[] rgb)
Set the encrypted content for detached content cases.
|
void |
setExternal(byte[] rgbData)
Set the optional external data field to be authenticated
|
DecodeFromBytes, DecodeFromBytes, DecodeFromCBORObject, EncodeCBORObject, EncodeToBytes, EncodeToCBORObject, GetContent, HasContent, SetContent, SetContentprotected String context
protected byte[] rgbEncrypt
protected com.upokecenter.cbor.CBORObject objProtected
protected com.upokecenter.cbor.CBORObject objUnprotected
protected com.upokecenter.cbor.CBORObject objDontSend
protected byte[] rgbProtected
protected byte[] externalData
@Deprecated public static final int ProtectedAttributes
@Deprecated public static final int UnprotectedAttributes
@Deprecated public static final int DontSendAttributes
public static final int PROTECTED
public static final int UNPROTECTED
public static final int DO_NOT_SEND
protected byte[] decryptWithKey(byte[] rgbKey)
throws CoseException,
org.bouncycastle.crypto.InvalidCipherTextException
CoseExceptionorg.bouncycastle.crypto.InvalidCipherTextExceptionpublic byte[] getEncryptedContent()
throws CoseException
CoseException - if content has not been encryptedpublic void setEncryptedContent(byte[] rgb)
rgb - encrypted content to be usedpublic void addAttribute(com.upokecenter.cbor.CBORObject label,
com.upokecenter.cbor.CBORObject value,
int where)
throws CoseException
label - CBOR object which identifies the attribute in the mapvalue - CBOR object which contains the value of the attributewhere - Identifies which of the buckets to place the attribute in.
ProtectedAttributes - attributes cryptographically protected
UnprotectedAttributes - attributes not cryptographically protected
DontSendAttributes - attributes used locally and not transmittedCoseException - COSE Package exceptionpublic void addAttribute(HeaderKeys label, com.upokecenter.cbor.CBORObject value, int where) throws CoseException
label - HeaderKeys label which identifies the attribute in the mapvalue - CBOR object which contains the value of the attributewhere - Identifies which of the buckets to place the attribute in.
ProtectedAttributes - attributes cryptographically protected
UnprotectedAttributes - attributes not cryptographically protected
DontSendAttributes - attributes used locally and not transmittedCoseException - COSE Package exceptionpublic void addAttribute(HeaderKeys label, byte[] value, int where) throws CoseException
label - HeaderKeys label which identifies the attribute in the mapvalue - CBOR object which contains the value of the attributewhere - Identifies which of the buckets to place the attribute in.
ProtectedAttributes - attributes cryptographically protected
UnprotectedAttributes - attributes not cryptographically protected
DontSendAttributes - attributes used locally and not transmittedCoseException - COSE Package exception@Deprecated public void AddProtected(com.upokecenter.cbor.CBORObject label, com.upokecenter.cbor.CBORObject value) throws CoseException
label - CBOR object which identifies the attribute in the mapvalue - CBOR object which contains the value of the attributeCoseException - COSE Package exception@Deprecated public void AddProtected(HeaderKeys label, com.upokecenter.cbor.CBORObject value) throws CoseException
label - HeaderKeys label which identifies the attribute in the mapvalue - CBOR object which contains the value of the attributeCoseException - COSE Package exception@Deprecated public void AddProtected(HeaderKeys label, byte[] value) throws CoseException
label - CBOR object which identifies the attribute in the mapvalue - byte array of valueCoseException - COSE Package exception@Deprecated public void AddUnprotected(com.upokecenter.cbor.CBORObject label, com.upokecenter.cbor.CBORObject value) throws CoseException
label - value identifies the attribute in the mapvalue - value to be associated with the labelCoseException - COSE Package exception@Deprecated public void AddUnprotected(HeaderKeys label, com.upokecenter.cbor.CBORObject value) throws CoseException
label - identifies the attribute in the mapvalue - value to be associated with the labelCoseException - COSE Package exception@Deprecated public void AddUnprotected(HeaderKeys label, byte[] value) throws CoseException
label - identifies the attribute in the mapvalue - value to be associated with the labelCoseException - COSE Package exceptionpublic com.upokecenter.cbor.CBORObject findAttribute(com.upokecenter.cbor.CBORObject label)
label - - Label of the value to be searched forpublic com.upokecenter.cbor.CBORObject findAttribute(com.upokecenter.cbor.CBORObject label,
int where)
label - - HeaderKey enumeration value to search forwhere - which maps to search for the labelpublic com.upokecenter.cbor.CBORObject findAttribute(HeaderKeys label)
label - - HeaderKey enumeration value to search forpublic com.upokecenter.cbor.CBORObject findAttribute(HeaderKeys label, int where)
label - - HeaderKey enumeration value to search forwhere - which maps to search for the labelpublic com.upokecenter.cbor.CBORObject getProtectedAttributes()
public com.upokecenter.cbor.CBORObject getUnprotectedAttributes()
public com.upokecenter.cbor.CBORObject getDoNotSendAttributes()
public void removeAttribute(com.upokecenter.cbor.CBORObject label)
throws CoseException
label - attribute to be removedCoseException - if integrity protection would be modified.public void removeAttribute(HeaderKeys label) throws CoseException
label - attribute to be removedCoseExceptionpublic byte[] getExternal()
public void setExternal(byte[] rgbData)
rgbData - - data to be authenticatedCOSE for Java documentation, generatedin 2016.