veraison / ccatoken

A library for Confidential Computing Architecture (CCA) Attestation Token
Apache License 2.0
1 stars 0 forks source link

a simpler interface for signing #14

Open thomas-fossati opened 2 years ago

thomas-fossati commented 2 years ago

The signing path is currently needlessly complex and also, as a consequence, more error prone.

The user has to:

  1. instantiate an evidence object
  2. add the platform claims-set to the evidence object
  3. add the realm claims-set to the evidence object
  4. sign the evidence object supplying the RAK and IAK

(note: in #11 we merged 2. and 3. together)

There is no real reason for splitting the add and sign operations (and therefore for the evidence object to exist as a temporary state holder): the two steps can be performed atomically by a standalone function like this:

// Sign returns the signed CCA collection in CBOR format
func Sign(
    platformClaims psatoken.IClaims,
    IClaims realmClaims,
    cose.Signer IAK,
    cose.Signer RAK,
) ([]byte, error)

Note: Doing so also makes it easy to set the realm's public key claim as well as the platform's nonce from the supplied RAK, thus avoiding