Class COSEUnprotectedHeader
java.lang.Object
com.authlete.cbor.CBORItem
com.authlete.cbor.CBORPairList
com.authlete.cose.COSEUnprotectedHeader
COSE Unprotected Header
- Since:
- 1.1
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCOSEUnprotectedHeader
(List<? extends CBORPair> pairs) A constructor with key-value pairs that represent the header parameters. -
Method Summary
Modifier and TypeMethodDescriptionstatic COSEUnprotectedHeader
Interpret the given CBOR data item as an unprotected header and build an instance ofCOSEUnprotectedHeader
from it.static COSEUnprotectedHeader
Build aCOSEUnprotectedHeader
instance from the given map.getAlg()
Get the value of the "alg (1)" parameter.Get the value of the "content type (3)" parameter.byte[]
getIv()
Get the value of the "IV (5)" parameter.byte[]
getKid()
Get the value of the "kid (4)" parameter.Get the set of parameters of this header as aMap
.byte[]
Get the value of the "Partial IV (6)" parameter.Get the value of the "x5chain (33)" parameter.Methods inherited from class com.authlete.cbor.CBORPairList
encode, findByKey, getPairs, parse, prettify, toString
Methods inherited from class com.authlete.cbor.CBORItem
encode, encodeMajorWithNumber, encodeToBase64, encodeToBase64Url, encodeToHex, getComment, prettify, setComment, toString
-
Constructor Details
-
COSEUnprotectedHeader
A constructor with key-value pairs that represent the header parameters.- Parameters:
pairs
- Header parameters.- Throws:
IllegalArgumentException
- There is one or more header parameters that do not conform to the requirements of 3.1. Common COSE Header Parameters.
-
-
Method Details
-
getParameters
-
getAlg
Get the value of the "alg (1)" parameter.The type of the value is an integer (
int
,long
orBigInteger
) or a string (String
).- Returns:
- The value of the "alg (1)" parameter. If the header does not
contain the parameter,
null
is returned. - See Also:
-
getContentType
Get the value of the "content type (3)" parameter.The type of the value is an unsigned integer (
int
,long
orBigInteger
) or a string (String
).- Returns:
- The value of the "content type (3)" parameter. If the header
does not contain the parameter,
null
is returned.
-
getKid
public byte[] getKid()Get the value of the "kid (4)" parameter.- Returns:
- The value of the "kid (4)" parameter. If the header does not
contain the parameter,
null
is returned.
-
getIv
public byte[] getIv()Get the value of the "IV (5)" parameter.- Returns:
- The value of the "IV (5)" parameter. If the header does not
contain the parameter,
null
is returned.
-
getPartialIv
public byte[] getPartialIv()Get the value of the "Partial IV (6)" parameter.- Returns:
- The value of the "Partial IV (6)" parameter. If the header
does not contain the parameter,
null
is returned.
-
getX5Chain
Get the value of the "x5chain (33)" parameter.- Returns:
- The value of the "x5chain (33)" parameter. If the header does
not contain the parameter,
null
is returned. - Since:
- 1.2
-
build
Interpret the given CBOR data item as an unprotected header and build an instance ofCOSEUnprotectedHeader
from it.- Parameters:
header
- A CBOR data item that represents a protected header. It must be a CBOR map.- Returns:
- An unprotected header.
- Throws:
COSEException
- The given CBOR data item does not conform to the requirements of unprotected header.
-
build
Build aCOSEUnprotectedHeader
instance from the given map.- Parameters:
map
- A map containing header parameters.- Returns:
- A
COSEUnprotectedHeader
instance built from the given map.
-