Class DefaultDGCSigner

  • All Implemented Interfaces:
    DGCSigner

    public class DefaultDGCSigner
    extends Object
    implements DGCSigner
    A bean implementing the DGCSigner interface.
    Author:
    Martin Lindström (martin@idsec.se), Henrik Bengtsson (extern.henrik.bengtsson@digg.se), Henric Norlander (extern.henric.norlander@digg.se)
    • Method Detail

      • sign

        public byte[] sign​(byte[] dgcPayload,
                           Instant expiration)
                    throws SignatureException
        Creates a CWT including the CBOR encoded DGC payload and signs it.

        Note: It is the caller's responsibility to ensure that the validity of the issued DGC does not exceed the validity of the signer's certificate (see DGCSigner.getSignerExpiration()).

        Specified by:
        sign in interface DGCSigner
        Parameters:
        dgcPayload - the CBOR encoding of the DGC payload
        expiration - the expiration time for the DGC
        Returns:
        the CBOR encoding of the signed CWT holding the DGC payload
        Throws:
        SignatureException - for signature errors
      • getSignerExpiration

        public Instant getSignerExpiration()
        Gets the point in time when this signer's certificate expires. For maximum interoperability, the validity of a DGC should not stretch beyond this time.
        Specified by:
        getSignerExpiration in interface DGCSigner
        Returns:
        the signer certificate expiration time
      • getSignerCountry

        public String getSignerCountry()
        Gets the ISO-3166 country code of the signer (issuer).
        Specified by:
        getSignerCountry in interface DGCSigner
        Returns:
        the country code of the signer
      • setSecurityProvider

        public void setSecurityProvider​(Provider securityProvider)
        Assigns a specific Java Security Provider that should be used when signing. If not assigned, a default provider will be used.
        Parameters:
        securityProvider - the security provider