Package se.digg.dgc.service.impl
Class DefaultDGCBarcodeEncoder
- java.lang.Object
-
- se.digg.dgc.service.impl.DefaultDGCEncoder
-
- se.digg.dgc.service.impl.DefaultDGCBarcodeEncoder
-
- All Implemented Interfaces:
DGCBarcodeEncoder
,DGCEncoder
public class DefaultDGCBarcodeEncoder extends DefaultDGCEncoder implements DGCBarcodeEncoder
A bean implementing theDGCBarcodeEncoder
interface.- Author:
- Martin Lindström (martin@idsec.se), Henrik Bengtsson (extern.henrik.bengtsson@digg.se), Henric Norlander (extern.henric.norlander@digg.se)
-
-
Constructor Summary
Constructors Constructor Description DefaultDGCBarcodeEncoder(DGCSigner dgcSigner, BarcodeCreator barcodeCreator)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Barcode
encodeToBarcode(byte[] dcc, Instant expiration)
Based on the CBOR encoded DCC payload and a expiration time, the method signs it, deflates it, Base45 encodes it, and finally delivers it as a barcode.Barcode
encodeToBarcode(DigitalCovidCertificate dcc, Instant expiration)
Based on the DCC payload and a expiration time, the method encodes the payload to CBOR, signs it, deflates it, Base45 encodes it, and finally delivers it as a barcode.-
Methods inherited from class se.digg.dgc.service.impl.DefaultDGCEncoder
encode, encode, sign, sign
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface se.digg.dgc.service.DGCEncoder
encode, encode, sign, sign
-
-
-
-
Constructor Detail
-
DefaultDGCBarcodeEncoder
public DefaultDGCBarcodeEncoder(DGCSigner dgcSigner, BarcodeCreator barcodeCreator)
Constructor.- Parameters:
dgcSigner
- a signer for signing the DGC:sbarcodeCreator
- the barcode creator to use
-
-
Method Detail
-
encodeToBarcode
public Barcode encodeToBarcode(DigitalCovidCertificate dcc, Instant expiration) throws DGCSchemaException, IOException, SignatureException, BarcodeException
Based on the DCC payload and a expiration time, the method encodes the payload to CBOR, signs it, deflates it, Base45 encodes it, and finally delivers it as a barcode.- Specified by:
encodeToBarcode
in interfaceDGCBarcodeEncoder
- Parameters:
dcc
- the contents of the DCCexpiration
- the expiration of the DCC- Returns:
- a barcode containing the signed DCC
- Throws:
DGCSchemaException
- for DCC schema errorsIOException
- for errors encoding data, for example CBOR related errorsSignatureException
- errors concerning signing the DCCBarcodeException
- errors creating the barcode
-
encodeToBarcode
public Barcode encodeToBarcode(byte[] dcc, Instant expiration) throws IOException, SignatureException, BarcodeException
Based on the CBOR encoded DCC payload and a expiration time, the method signs it, deflates it, Base45 encodes it, and finally delivers it as a barcode.- Specified by:
encodeToBarcode
in interfaceDGCBarcodeEncoder
- Parameters:
dcc
- the contents of the DCC in its CBOR encodingexpiration
- the expiration of the DCC- Returns:
- a barcode containing the signed DCC
- Throws:
IOException
- for errors encoding data, for example CBOR related errorsSignatureException
- errors concerning signing the DCCBarcodeException
- errors creating the barcode
-
-