This is a continuation of [Draft] Notation Extensibility for Signing and Verification doc.
PR Begins - This is in early brainstorming stage
Plugin installation and config
// Descriptor
{
"mediaType": "application/vnd.oci.image.manifest.v1+json",
"digest": "sha256:73c803930ea3ba1e54bc25c2bdc53edd0284c62ed651fe7b00369da519a3c333",
"size": 16724,
"annotations": {
"org.cncf.notary.signature.plugin.identifier": "${name}-${version}",
"org.cncf.notary.signature.plugin.required": "true | false",
...
}
}
Plugin metadata
{
// List of one or more capabilities supported by plugin.
// SIGNATURE_GENERATOR and SIGNATURE_ENVELOPE_GENERATOR are mutually exclusive
// only one can be specified.
// SIGNATURE_GENERATOR
// SIGNATURE_ENVELOPE_GENERATOR
// SIGNATURE_VERIFIER
"capabilities" : [
]
}
capabilities - This is list of major features supported by a plugin. Each capability such as SIGNATURE_ENVELOPE_GENERATOR
requires one of more commands to be implemented by the plugin. When new features are available for plugins to implement, an implementation may choose to not implement it, and therefore will not include the feature in capabililies. Notation will evaluate the capability required to satisfy a user’s request, and reject the request if the plugin does not support the required capability.
Requirements
Notation will support plugins to be developed against the Signature Verifier interface. These interface target abstraction levels that satisfy most plugin integration scenarios.
This interface allows a plugin publisher to perform custom validations on the artifact's signature. The custom validations supplements the default notary v2 signature validations. The plugin must ve signature envelope format agnostic but should have access to all the .
During signature verification, if the required plugin is unavailable then Notary v2 MUST fails the signature verification.
This interface allows plugins to have full control over the generated signature envelope, and can append additional signed and unsigned metadata, including timestamp signatures. The plugin must be signature envelope format aware, and implement new formats when Notary adopts new formats.
Signing workflow using plugin
image
, with key
image
url, and construct a descriptordiscover
command
SIGNATURE_ENVELOPE_GENERATOR
generate-envelope
command, set request.key
to key definition (from /notation/config.json
), request.payload
to base64 encoded descriptor, request.payloadType
to application/vnd.oci.descriptor.v1+json
and request.signatureEnvelopeType
to application/vnd.cncf.notary.v2.jws.v1
.response.signatureEnvelope
contains the base64 encoded signature envelope, value of response.signatureEnvelopeType
MUST match request.signatureEnvelopeType.response.annotations
to manifest annotations.SIGNATURE_GENERATOR
(covered in previous section)generate-envelope
Request
{
"contract-version" : <major-version.minor-version>,
// Complete key definition from /notation/config.JSON /signingKeys/keys with matching key name
"key" : <key definition>,
"payload" : <Base64 encoded payload to be signed>,
// The type of payload - currently a descriptor
"payloadType" : "application/vnd.oci.descriptor.v1+json",
// The expected response signature envelope
"signatureEnvelopeType" : "application/vnd.cncf.notary.v2.jws.v1"
}
signatureEnvelopeType - defines the type of signature envelope expected from the plugin. As Notation clients need to be updated in order to parse and verify new signature formats, the default signature format can only be changed with new major version releases of Notation. Users however can opt into using an updated signature format supported by Notation, by passing an optional parameter.
e.g. notation sign $IMAGE --key {key-name} --signatureFormat {some-new-format}
Response
{
"signatureEnvelope": <Base64 encoded signature envelope>,
"signatureEnvelopeType" : "application/vnd.cncf.notary.v2.jws.v1"
// Annotations to be appended to Signature Manifest annotations
"annotations" : {
"key1" : "value1",
"key2" : "value2"
}
}
This interface allows a plugin publisher to perform custom validations on the artifact's signature. The custom validations supplements the default notary v2 signature validations. The plugin is signature envelope format agnostic.
During signature verification, if the required plugin is unavailable then Notary v2 MUST fails the signature verification.
Request
{
// The version of verify-signature interface
"version": "<major-version.minor-version>",
// The complete key definition from /notation/config.JSON
"key": "<keydefinition>",
"signature": {
// The signature envelope type - currently JWS
"envelopeType": "application/jose+json"
// The version of the signature envelope
"version": "application/vnd.cncf.notary.v2.jws.v1",
// The signature algoritm
"algorithm": "<signature-algorithm>",
// The signed playload
"payload": "<Base64 encoded signed payload>",
// The type of payload - currently a descriptor
"payloadType": "application/vnd.oci.descriptor.v1+json",
// The siged metadata
"signedAttributes": {
"notary": {
"iat": <signing-time>,
"exp": <signature-expiration-time>
}
},
// The list of signing certificate used for signature verification
"x509SigningCcertificates": [],
// The list of timestamping certificate used for timestamp verification
"x509TimestampingCertificates": []
},
// The repository URI of the artifact
"artifactUri": "",
// The complete trust policy with trust store inlined used for siganture evaluation
"trustPolicy": ""
}
signatureEnvelopeType - defines the type of signature envelope expected from the plugin. As updated Notation clients are required to understand and verify new signature formats, the default signature format can only be changed with new major version releases of Notation. Users however can opt into using an updated signature format supported by Notation, by passing an optional parameter.
e.g. notation sign $IMAGE --key {key-name} --signatureFormat {some-new-format}
Response
The
{
"warnings": [
"<line1>",
"<line2>",
"<line3>"
]
}
Plugin exit codes:
CLI exit codes:
PR Ends
describe-key
should not be tied to signature generation