Package se.digg.dgc.service
Interface DGCEncoder
-
- All Known Subinterfaces:
DGCBarcodeEncoder
- All Known Implementing Classes:
DefaultDGCBarcodeEncoder
,DefaultDGCEncoder
public interface DGCEncoder
Service for creating Digital Green Certificates.- Author:
- Martin Lindström (martin@idsec.se), Henrik Bengtsson (extern.henrik.bengtsson@digg.se), Henric Norlander (extern.henric.norlander@digg.se)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description String
encode(byte[] dgc, Instant expiration)
Based on the CBOR encoded DGC payload and a expiration time, the method signs it, deflates it, and delivers it in Base45 encoding (with a HCERT header).String
encode(DigitalGreenCertificate dgc, Instant expiration)
Based on the DGC payload and a expiration time, the method encodes the payload to CBOR, signs it, deflates it, and delivers it in Base45 encoding (with a HCERT header).byte[]
sign(byte[] dgc, Instant expiration)
Given the CBOR-encoding of the DGC payload the method creates a CWT and signs it.byte[]
sign(DigitalGreenCertificate dgc, Instant expiration)
Given the DGC payload the method creates a CWT and signs it.
-
-
-
Method Detail
-
encode
String encode(DigitalGreenCertificate dgc, Instant expiration) throws DGCSchemaException, IOException, SignatureException
Based on the DGC payload and a expiration time, the method encodes the payload to CBOR, signs it, deflates it, and delivers it in Base45 encoding (with a HCERT header).- Parameters:
dgc
- the contents of the DGCexpiration
- the expiration of the DGC- Returns:
- the Base45 encoding of the signed DGC
- Throws:
DGCSchemaException
- for DGC schema errorsIOException
- for errors encoding data, for example CBOR related errorsSignatureException
- errors concerning signing the DGC
-
encode
String encode(byte[] dgc, Instant expiration) throws IOException, SignatureException
Based on the CBOR encoded DGC payload and a expiration time, the method signs it, deflates it, and delivers it in Base45 encoding (with a HCERT header).- Parameters:
dgc
- the contents of the DGC in its CBOR encodingexpiration
- the expiration of the DGC- Returns:
- the Base45 encoding of the signed DGC
- Throws:
IOException
- for errors encoding data, for example CBOR related errorsSignatureException
- errors concerning signing the DGC
-
sign
byte[] sign(DigitalGreenCertificate dgc, Instant expiration) throws DGCSchemaException, IOException, SignatureException
Given the DGC payload the method creates a CWT and signs it.- Parameters:
dgc
- the DGC payloadexpiration
- the expiration time of the DGC- Returns:
- the CBOR encoding of the signed DGC (CWT)
- Throws:
DGCSchemaException
- for DGC schema errorsIOException
- for errors encoding data, for example CBOR related errorsSignatureException
- errors concerning signing the DGC
-
sign
byte[] sign(byte[] dgc, Instant expiration) throws IOException, SignatureException
Given the CBOR-encoding of the DGC payload the method creates a CWT and signs it.- Parameters:
dgc
- the DGC payload in its CBOR encodingexpiration
- the expiration of the DGC- Returns:
- the CBOR encoding of the signed DGC (CWT)
- Throws:
IOException
- for errors encoding data, for example CBOR related errorsSignatureException
- errors concerning signing the DGC
-
-