Class IssuerSignedBuilder
IssuerSigned instance.
An IssuerSigned instanced is used to create a Document
instance.
- Since:
- 1.5
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Build anIssuerSignedinstance.Get theCBORizerto convert given claim values into CBOR items.Get the claims used to createIssuerSignedItems.Get the device key.Get the DocType.Get the signer to sign the Issuer Auth structure.Get the certificate chain for the issuer key.Get the issuer key used to sign theIssuerAuthstructure (COSESign1).Get the validity information of the Mobile Security Object.setCBORizer(CBORizer cborizer) Set theCBORizerto convert given claim values into CBOR items.Set the claims used to createIssuerSignedItems.setDeviceKey(COSEKey deviceKey) Set the device key.setDocType(String docType) Set the DocType.Set the signer to sign the Issuer Auth structure.setIssuerCertChain(List<X509Certificate> chain) Set the certificate chain for the issuer key.setIssuerKey(COSEEC2Key issuerKey) Set the issuer key used to sign theIssuerAuthstructure (COSESign1).setValidityInfo(ValidityInfo info) Set the validity information of the Mobile Security Object.
-
Constructor Details
-
IssuerSignedBuilder
public IssuerSignedBuilder()
-
-
Method Details
-
getDocType
Get the DocType.The value is used as the value of the
"docType"parameter of theMobileSecurityObject.- Returns:
- The DocType.
-
setDocType
Set the DocType.The value is used as the value of the
"docType"parameter of theMobileSecurityObjectstructure.- Parameters:
docType- The DocType.- Returns:
- return
thisobject.
-
getClaims
Get the claims used to createIssuerSignedItems.See the description of the
setClaims(Map)method for details about the format.- Returns:
- The claims used to create
IssuerSignedItems.
-
setClaims
Set the claims used to createIssuerSignedItems.The keys of the top-level properties in the
claimsmap must be strings representing name spaces, and their values must be JSON objects, each of which contains claims under the corresponding name space.The following JSON shows the structure that the
claimsmap should have.{ "com.example.namespace1" : { "claimName1": "claimValue1", "claimName2": true, "claimName3": 1 }, "com.example.namespace2" : { "claimName4": [ "element1", "element2" ], "claimName5": { "subClaimName1": "subClaimValue1" } } }Types of claim values can be strings, boolean values, integers, floating-point numbers, arrays (
List) and maps (Map), which are natural representations of JSON values.However, there may be cases where CBOR-specific data need to be embedded. For example, the
"birth_date"claim may require the "full-date" tag (defined in RFC 8943) and the"portrait"claim may require binary data.To embed CBOR-specific data, a
CBORizerinstance with an implementation of theCBORDiagnosticNotationParserinterface needs to be set by calling thesetCBORizer(CBORizer)method. SuchCBORizerwill interpret strings written in the CBOR Diagnostic Notation (RFC 8949 Section 8, RFC 8610 Appendix G) with a special prefix (e.g."cbor:"), and convert them into CBOR-specific data. As a result, input data like below will be accepted and CBOR-specific data will be embedded accordingly.{ "com.example.namespace3": { "birth_date": "cbor:1004(\"1974-05-06\")", "portrait": "cbor:h'0102.....'" } }- Parameters:
claims- The claims used to createIssuerSignedItems.- Returns:
thisobject.
-
getValidityInfo
Get the validity information of the Mobile Security Object.The value is used as the value of the
"validityInfo"parameter of theMobileSecurityObjectstructure.- Returns:
- The validity information of the Mobile Security Object.
-
setValidityInfo
Set the validity information of the Mobile Security Object.The value is used as the value of the
"validityInfo"parameter of theMobileSecurityObjectstructure.- Parameters:
info- The validity information of the Mobile Security Object.- Returns:
thisobject.
-
getDeviceKey
Get the device key.The value is used as the value of the
"deviceKey"parameter of theDeviceKeyInfostructure.- Returns:
- The device key.
-
setDeviceKey
Set the device key.The value is used as the value of the
"deviceKey"parameter of theDeviceKeyInfostructure.- Parameters:
deviceKey- The device key.- Returns:
thisobject.
-
getIssuerKey
Get the issuer key used to sign theIssuerAuthstructure (COSESign1).- Returns:
- The issuer key.
-
setIssuerKey
Set the issuer key used to sign theIssuerAuthstructure (COSESign1).If a signer is not provided through the
setIssuerAuthSigner(SigStructureSigner)method, a private key must be set. Conversely, if a signer is provided, a key still needs to be set, but it does not necessarily have to be a private key. In this case, the key set by this method is not used for signing the Issuer Auth structure.- Parameters:
issuerKey- The issuer key.- Returns:
thisobject.- See Also:
-
getIssuerCertChain
Get the certificate chain for the issuer key.The value is embedded in the unprotected header of the
IssuerAuthstructure (COSESign1) as the value of thex5chainheader parameter.- Returns:
- The certificate chain for the issuer key.
- See Also:
-
setIssuerCertChain
Set the certificate chain for the issuer key.The value is embedded in the unprotected header of the
IssuerAuthstructure (COSESign1) as the value of thex5chainheader parameter.- Parameters:
chain- The certificate chain for the issuer key.- Returns:
thisobject.- See Also:
-
getCBORizer
Get theCBORizerto convert given claim values into CBOR items.If there are claim values expressed in the CBOR Diagnostic Notation like
"cbor:h'0102'"and"cbor:0(\"2013-03-21T20:04:00Z\")", aCBORizerinstance withCBORDiagnosticNotationParserneeds to be explicitly set. Otherwise, strings expressed in the CBOR Diagnostic Notation are embedded as CBOR text strings without any conversion.- Returns:
- The
CBORizer.
-
setCBORizer
Set theCBORizerto convert given claim values into CBOR items.If there are claim values expressed in the CBOR Diagnostic Notation like
"cbor:h'0102'"and"cbor:0(\"2013-03-21T20:04:00Z\")", aCBORizerinstance withCBORDiagnosticNotationParserneeds to be explicitly set. Otherwise, strings expressed in the CBOR Diagnostic Notation are embedded as CBOR text strings without any conversion.- Parameters:
cborizer- TheCBORizer.- Returns:
thisobject.
-
getIssuerAuthSigner
Get the signer to sign the Issuer Auth structure.- Returns:
- The signer to sign the Issuer Auth structure.
- Since:
- 1.20
-
setIssuerAuthSigner
Set the signer to sign the Issuer Auth structure.If a signer is provided through this method, it will be used to sign the Issuer Auth structure. Conversely, if no signer is provided, a new
COSESignerinstance will be created with the private key set by thesetIssuerKey(COSEEC2Key)method, and the instance will be used to sign the Issuer Auth structure.- Parameters:
signer- The signer to sign the Issuer Auth structure.- Returns:
thisobject.- Since:
- 1.20
- See Also:
-
build
Build anIssuerSignedinstance.- Returns:
- A new
IssuerSignedinstance. - Throws:
COSEException- Signing with the issuer key failed.CertificateEncodingException- The DER representation of an X.509 certificate in the issuer's certificate chain failed to be obtained.
-