Skip to content

Latest commit

 

History

History
20 lines (20 loc) · 4.29 KB

CoseSign1.Abstractions.md

File metadata and controls

20 lines (20 loc) · 4.29 KB

CoseSign1.Abstractions is a .NET Standard 2.0 series of interfaces, abstract classes and base level exceptions which, when implemented, can standardize the creation of, and validation of CoseSign1Message objects in C#.

Dependencies

CoseSign1.Abstractions has the following package dependencies

  • System.Formats.Cbor >= 7.0.0
  • System.Security.Cryptography.Cose >= 7.0.0

Creation

The .NET CoseSigner class is the foundation for creating a CoseSign1Message object. While this class could be used in conjunction with various CoseSign1Message methods to create a CoseSign1Message object, it does not provide for consistent application of CoseSign1Message.ProtectedHeader fields which must be populated prior to the signing operation taking place. This library offers creation interface contracts, which when used by CoseSign1 can ensure that for given CoseSigner operation, that all Protected headers are populated correctly and consistently. Concrete examples of this requirement would be, if signing a CoseSign1Message with a X509Certificate2 object, then the x5t and x5chain (34 and 33) protected headers must be populated prior to the signing operation. These requirements are enforced in CoseSign1.Certificates via the abstract X509Certificate2CoseSigningKeyProvider class.

This interface, when implemented by a class, should allow for the retrial of either an RSA or ECDsa key for signing purposes, as well as implement any Protected or UnProtected header manipulation expected prior to the signing operation of the CoseSign1Message object.

This interface, when implement by a class, should allow for the manipulation of a protected or unprotected CoseHeaderMap. This interface is intended to give the consumer/caller the ability to inject additional fields into the ProtectedHeader specifically prior to the signing of the CoseSign1Message object.

Validation

CoseSign1Message objects naturally have the ability to validate via the CoseSign1Message.Verify*(...) API sets. This validation simply ensures that the CoseSign1Message hasn't been tampered with since it was sealed using the given AsymmetricAlgorithm (public key). Additional validation may be warranted to provide additional validation. A singly linked list pattern is implemented via the CoseSign1MessageValidator abstract base class which when implemented by a derived class should perform CoseSign1Message validation specific to that key provider.

This class implements the following: CoseSign1MessageValidator - Abstract base class which implements a singly linked list pattern of validation elements. EmptyValidator - an Empty validator class provided for ease of testing. Can be accessed through CoseSign1MessageValidator.None static property.

This class represents the result of a validation effort by a CoseSign1MessageValidator. It's intended to convey interesting information related to the validation effort of the CoseSign1Message object.