Skip to content

Commit 9cd17b5

Browse files
kommendorkaptenrdimitrov
authored andcommitted
Updated the default ecdsa p256 key type to not include any parameters. (#82)
Since TUF spec 1.0.32 the key type for ecdsa does not include the parameters, they are only part of the key-scheme. This commit updates the default keytype to not include the parameters, but includes a compatibility key type to be able to accept metadata compliant with older versions of the spec. Signed-off-by: Fredrik Skogman <[email protected]>
1 parent 1d8ae3c commit 9cd17b5

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

metadata/keys.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ import (
2626
)
2727

2828
const (
29-
KeyTypeEd25519 = "ed25519"
30-
KeyTypeECDSA_SHA2_P256 = "ecdsa-sha2-nistp256"
31-
KeyTypeECDSA_SHA2_P256_SSLIB = "ecdsa"
32-
KeyTypeRSASSA_PSS_SHA256 = "rsa"
33-
KeySchemeEd25519 = "ed25519"
34-
KeySchemeECDSA_SHA2_P256 = "ecdsa-sha2-nistp256"
35-
KeySchemeRSASSA_PSS_SHA256 = "rsassa-pss-sha256"
29+
KeyTypeEd25519 = "ed25519"
30+
KeyTypeECDSA_SHA2_P256_COMPAT = "ecdsa-sha2-nistp256"
31+
KeyTypeECDSA_SHA2_P256 = "ecdsa"
32+
KeyTypeRSASSA_PSS_SHA256 = "rsa"
33+
KeySchemeEd25519 = "ed25519"
34+
KeySchemeECDSA_SHA2_P256 = "ecdsa-sha2-nistp256"
35+
KeySchemeRSASSA_PSS_SHA256 = "rsassa-pss-sha256"
3636
)
3737

3838
// ToPublicKey generate crypto.PublicKey from metadata type Key
@@ -52,7 +52,7 @@ func (k *Key) ToPublicKey() (crypto.PublicKey, error) {
5252
return nil, err
5353
}
5454
return rsaKey, nil
55-
case KeyTypeECDSA_SHA2_P256, KeyTypeECDSA_SHA2_P256_SSLIB: // handle "ecdsa" too as python-tuf/sslib keys are using it for keytype instead of https://theupdateframework.github.io/specification/latest/index.html#keytype-ecdsa-sha2-nistp256
55+
case KeyTypeECDSA_SHA2_P256, KeyTypeECDSA_SHA2_P256_COMPAT: // handle "ecdsa" too as python-tuf/sslib keys are using it for keytype instead of https://theupdateframework.github.io/specification/latest/index.html#keytype-ecdsa-sha2-nistp256
5656
publicKey, err := cryptoutils.UnmarshalPEMToPublicKey([]byte(k.Value.PublicKey))
5757
if err != nil {
5858
return nil, err

0 commit comments

Comments
 (0)