Package se.digg.dgc.service.impl
Class DefaultDGCBarcodeDecoder
- java.lang.Object
-
- se.digg.dgc.service.impl.DefaultDGCDecoder
-
- se.digg.dgc.service.impl.DefaultDGCBarcodeDecoder
-
- All Implemented Interfaces:
DGCBarcodeDecoder,DGCDecoder
public class DefaultDGCBarcodeDecoder extends DefaultDGCDecoder implements DGCBarcodeDecoder
A bean implementing theDGCBarcodeDecoderinterface.- 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 DefaultDGCBarcodeDecoder(DGCSignatureVerifier dgcSignatureVerifier, CertificateProvider certificateProvider, BarcodeDecoder barcodeDecoder)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DigitalCovidCertificatedecodeBarcode(byte[] image)Given a barcode image the method verifies amd decodes the contents into its DCC payload representation.byte[]decodeBarcodeToBytes(byte[] image)Given a barcode image the method verifies and decodes the contents into the CBOR encoding of the DCC payload.-
Methods inherited from class se.digg.dgc.service.impl.DefaultDGCDecoder
decode, decodeRaw, decodeRawToBytes, decodeToBytes
-
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.DGCDecoder
decode, decodeRaw, decodeRawToBytes, decodeToBytes
-
-
-
-
Constructor Detail
-
DefaultDGCBarcodeDecoder
public DefaultDGCBarcodeDecoder(DGCSignatureVerifier dgcSignatureVerifier, CertificateProvider certificateProvider, BarcodeDecoder barcodeDecoder)
Constructor.- Parameters:
dgcSignatureVerifier- the signature verifier - if null, an instance ofDefaultDGCSignatureVerifierwill be usedcertificateProvider- the certificate provider that is used to locate certificates to use when verifying signaturesbarcodeDecoder- the barcode decoder to use
-
-
Method Detail
-
decodeBarcode
public DigitalCovidCertificate decodeBarcode(byte[] image) throws DGCSchemaException, SignatureException, CertificateExpiredException, BarcodeException, IOException
Given a barcode image the method verifies amd decodes the contents into its DCC payload representation.- Specified by:
decodeBarcodein interfaceDGCBarcodeDecoder- Parameters:
image- the barcode image holding the encoded and signed DCC- Returns:
- the DCC payload
- Throws:
DGCSchemaException- for DCC schema errorsSignatureException- for signature verification errorsCertificateExpiredException- if the DCC has expiredBarcodeException- for errors reading the barcodeIOException- for errors decoding data, for example CBOR related errors- See Also:
DGCBarcodeDecoder.decodeBarcodeToBytes(byte[])
-
decodeBarcodeToBytes
public byte[] decodeBarcodeToBytes(byte[] image) throws SignatureException, CertificateExpiredException, BarcodeException, IOExceptionGiven a barcode image the method verifies and decodes the contents into the CBOR encoding of the DCC payload.- Specified by:
decodeBarcodeToBytesin interfaceDGCBarcodeDecoder- Parameters:
image- the barcode image holding the encoded and signed DCC- Returns:
- the DCC payload in its CBOR representation
- Throws:
SignatureException- for signature verification errorsCertificateExpiredException- if the DCC has expiredBarcodeException- for errors reading the barcodeIOException- for errors decoding data, for example CBOR related errors- See Also:
DGCBarcodeDecoder.decodeBarcode(byte[])
-
-