Debian Codegraph @

verifier/oci/interface.go

raw
1 // Package oci contains functionalities to interact with OCI image signatures.
2 // https://github.com/opencontainers/image-spec/tree/main#readme.
3 package oci
4
5 // SigningAlgorithm is a specific type for string constants used for sigature signing and verification.
6 type SigningAlgorithm string
7
8 const (
9 // RSASSAPSS2048SHA256 is RSASSA-PSS 2048 bit key with a SHA256 digest supported for cosign sign.
10 RSASSAPSS2048SHA256 SigningAlgorithm = "RSASSA_PSS_SHA256"
11 // RSASSAPSS3072SHA256 is RSASSA-PSS 3072 bit key with a SHA256 digest supported for cosign sign.
12 RSASSAPSS3072SHA256 SigningAlgorithm = "RSASSA_PSS_SHA256"
13 // RSASSAPSS4096SHA256 is RSASSA-PSS 4096 bit key with a SHA256 digest supported for cosign sign.
14 RSASSAPSS4096SHA256 SigningAlgorithm = "RSASSA_PSS_SHA256"
15 // RSASSAPKCS1V152048SHA256 is RSASSA-PKCS1 v1.5 2048 bit key with a SHA256 digest supported for cosign sign.
16 RSASSAPKCS1V152048SHA256 SigningAlgorithm = "RSASSA_PKCS1V15_SHA256"
17 // RSASSAPKCS1V153072SHA256 is RSASSA-PKCS1 v1.5 3072 bit key with a SHA256 digest supported for cosign sign.
18 RSASSAPKCS1V153072SHA256 SigningAlgorithm = "RSASSA_PKCS1V15_SHA256"
19 // RSASSAPKCS1V154096SHA256 is RSASSA-PKCS1 v1.5 4096 bit key with a SHA256 digest supported for cosign sign.
20 RSASSAPKCS1V154096SHA256 SigningAlgorithm = "RSASSA_PKCS1V15_SHA256"
21 // ECDSAP256SHA256 is ECDSA on the P-256 Curve with a SHA256 digest supported for cosign sign.
22 ECDSAP256SHA256 SigningAlgorithm = "ECDSA_P256_SHA256"
23 )
24
25 // Signature represents a single OCI image signature.
26 type Signature interface {
27 // Payload returns the blob data associated with a signature uploaded to an OCI registry.
28 Payload() ([]byte, error)
29
30 // Base64Encoded returns the base64-encoded signature of the signed payload.
31 Base64Encoded() (string, error)
32
33 // PublicKey returns a public key in the format of PEM-encoded byte slice.
34 PublicKey() ([]byte, error)
35
36 // SigningAlgorithm returns the signing algorithm specifications in the format of:
37 // 1. RSASSAPSS2048SHA256 (RSASSA algorithm with PSS padding 2048 bit key with a SHA256 digest)
38 // 2. RSASSAPSS3072SHA256 (RSASSA algorithm with PSS padding 3072 bit key with a SHA256 digest)
39 // 3. RSASSAPSS4096SHA256 (RSASSA algorithm with PSS padding 4096 bit key with a SHA256 digest)
40 // 4. RSASSAPKCS1V152048SHA256 (RSASSA algorithm with PKCS #1 v1.5 padding 2048 bit key with a SHA256 digest)
41 // 5. RSASSAPKCS1V153072SHA256 (RSASSA algorithm with PKCS #1 v1.5 padding 3072 bit key with a SHA256 digest)
42 // 6. RSASSAPKCS1V154096SHA256 (RSASSA algorithm with PKCS #1 v1.5 padding 4096 bit key with a SHA256 digest)
43 // 7. ECDSAP256SHA256 (ECDSA on the P-256 Curve with a SHA256 digest)
44 SigningAlgorithm() (SigningAlgorithm, error)
45 }