1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
|
from enum import Enum
class COSEAlgorithmIdentifier(int, Enum):
"""Various registered values indicating cryptographic algorithms that may be used in credential responses
Members:
`ECDSA_SHA_256`
`EDDSA`
`ECDSA_SHA_512`
`RSASSA_PSS_SHA_256`
`RSASSA_PSS_SHA_384`
`RSASSA_PSS_SHA_512`
`RSASSA_PKCS1_v1_5_SHA_256`
`RSASSA_PKCS1_v1_5_SHA_384`
`RSASSA_PKCS1_v1_5_SHA_512`
`RSASSA_PKCS1_v1_5_SHA_1`
https://www.w3.org/TR/webauthn-2/#sctn-alg-identifier
https://www.iana.org/assignments/cose/cose.xhtml#algorithms
"""
ECDSA_SHA_256 = -7
EDDSA = -8
ECDSA_SHA_512 = -36
RSASSA_PSS_SHA_256 = -37
RSASSA_PSS_SHA_384 = -38
RSASSA_PSS_SHA_512 = -39
RSASSA_PKCS1_v1_5_SHA_256 = -257
RSASSA_PKCS1_v1_5_SHA_384 = -258
RSASSA_PKCS1_v1_5_SHA_512 = -259
RSASSA_PKCS1_v1_5_SHA_1 = -65535 # Deprecated; here for legacy support
class COSEKTY(int, Enum):
"""
Possible values for COSEKey.KTY representing a public key's key type
https://tools.ietf.org/html/rfc8152#section-13
https://www.iana.org/assignments/cose/cose.xhtml#table-key-type
"""
OKP = 1
EC2 = 2
RSA = 3
class COSECRV(int, Enum):
"""Possible values for COSEKey.CRV representing an EC2 public key's curve
https://tools.ietf.org/html/rfc8152#section-13.1
https://www.iana.org/assignments/cose/cose.xhtml#table-elliptic-curves
"""
P256 = 1 # EC2, NIST P-256 also known as secp256r1
P384 = 2 # EC2, NIST P-384 also known as secp384r1
P521 = 3 # EC2, NIST P-521 also known as secp521r1
ED25519 = 6 # OKP, Ed25519 for use w/ EdDSA only
class COSEKey(int, Enum):
"""
COSE keys for public keys
https://tools.ietf.org/html/rfc8152
https://www.iana.org/assignments/cose/cose.xhtml#table-key-common-parameters
https://www.iana.org/assignments/cose/cose.xhtml#table-key-type-parameters
"""
KTY = 1
ALG = 3
# EC2, OKP
CRV = -1
X = -2
# EC2
Y = -3
# RSA
N = -1
E = -2
|