38
38
* registered in the IANA COSE Algorithms registry, for instance, -7 for "ES256" and -257 for
39
39
* "RS256".
40
40
*
41
+ * @since 0.3.0
41
42
* @see <a
42
43
* href="https://www.w3.org/TR/2021/REC-webauthn-2-20210408/#typedefdef-cosealgorithmidentifier">§5.10.5.
43
44
* Cryptographic Algorithm Identifier (typedef COSEAlgorithmIdentifier)</a>
44
45
*/
45
46
public enum COSEAlgorithmIdentifier {
47
+
48
+ /**
49
+ * The signature scheme Ed25519 as defined in <a href="https://www.rfc-editor.org/rfc/rfc8032">RFC
50
+ * 8032</a>.
51
+ *
52
+ * <p>Note: This COSE identifier does not in general identify the full Ed25519 parameter suite,
53
+ * but is specialized to that meaning within the WebAuthn API.
54
+ *
55
+ * @since 1.4.0
56
+ * @see <a href="https://www.iana.org/assignments/cose/cose.xhtml#algorithms">COSE Algorithms
57
+ * registry</a>
58
+ * @see <a href="https://www.rfc-editor.org/rfc/rfc8032">RFC 8032</a>
59
+ * @see <a href="https://www.w3.org/TR/2021/REC-webauthn-2-20210408/#sctn-alg-identifier">WebAuthn
60
+ * §5.8.5. Cryptographic Algorithm Identifier (typedef <code>COSEAlgorithmIdentifier</code>
61
+ * )</a>
62
+ */
46
63
EdDSA (-8 ),
64
+
65
+ /**
66
+ * ECDSA with SHA-256 on the NIST P-256 curve.
67
+ *
68
+ * <p>Note: This COSE identifier does not in general restrict the curve to P-256, but is
69
+ * specialized to that meaning within the WebAuthn API.
70
+ *
71
+ * @since 0.3.0
72
+ * @see <a href="https://www.iana.org/assignments/cose/cose.xhtml#algorithms">COSE Algorithms
73
+ * registry</a>
74
+ * @see <a href="https://www.w3.org/TR/2021/REC-webauthn-2-20210408/#sctn-alg-identifier">WebAuthn
75
+ * §5.8.5. Cryptographic Algorithm Identifier (typedef <code>COSEAlgorithmIdentifier</code>
76
+ * )</a>
77
+ */
47
78
ES256 (-7 ),
79
+
80
+ /**
81
+ * ECDSA with SHA-384 on the NIST P-384 curve.
82
+ *
83
+ * <p>Note: This COSE identifier does not in general restrict the curve to P-384, but is
84
+ * specialized to that meaning within the WebAuthn API.
85
+ *
86
+ * @since 2.1.0
87
+ * @see <a href="https://www.iana.org/assignments/cose/cose.xhtml#algorithms">COSE Algorithms
88
+ * registry</a>
89
+ * @see <a href="https://www.w3.org/TR/2021/REC-webauthn-2-20210408/#sctn-alg-identifier">WebAuthn
90
+ * §5.8.5. Cryptographic Algorithm Identifier (typedef <code>COSEAlgorithmIdentifier</code>
91
+ * )</a>
92
+ */
48
93
ES384 (-35 ),
94
+
95
+ /**
96
+ * ECDSA with SHA-512 on the NIST P-521 curve.
97
+ *
98
+ * <p>Note: This COSE identifier does not in general restrict the curve to P-521, but is
99
+ * specialized to that meaning within the WebAuthn API.
100
+ *
101
+ * @since 2.1.0
102
+ * @see <a href="https://www.iana.org/assignments/cose/cose.xhtml#algorithms">COSE Algorithms
103
+ * registry</a>
104
+ * @see <a href="https://www.w3.org/TR/2021/REC-webauthn-2-20210408/#sctn-alg-identifier">WebAuthn
105
+ * §5.8.5. Cryptographic Algorithm Identifier (typedef <code>COSEAlgorithmIdentifier</code>
106
+ * )</a>
107
+ */
49
108
ES512 (-36 ),
109
+
110
+ /**
111
+ * RSASSA-PKCS1-v1_5 using SHA-256.
112
+ *
113
+ * @since 0.3.0
114
+ * @see <a href="https://www.iana.org/assignments/cose/cose.xhtml#algorithms">COSE Algorithms
115
+ * registry</a>
116
+ */
50
117
RS256 (-257 ),
118
+
119
+ /**
120
+ * RSASSA-PKCS1-v1_5 using SHA-384.
121
+ *
122
+ * @since 2.4.0
123
+ * @see <a href="https://www.iana.org/assignments/cose/cose.xhtml#algorithms">COSE Algorithms
124
+ * registry</a>
125
+ */
51
126
RS384 (-258 ),
127
+
128
+ /**
129
+ * RSASSA-PKCS1-v1_5 using SHA-512.
130
+ *
131
+ * @since 2.4.0
132
+ * @see <a href="https://www.iana.org/assignments/cose/cose.xhtml#algorithms">COSE Algorithms
133
+ * registry</a>
134
+ */
52
135
RS512 (-259 ),
136
+
137
+ /**
138
+ * RSASSA-PKCS1-v1_5 using SHA-1.
139
+ *
140
+ * @since 1.5.0
141
+ * @see <a href="https://www.iana.org/assignments/cose/cose.xhtml#algorithms">COSE Algorithms
142
+ * registry</a>
143
+ */
53
144
RS1 (-65535 );
54
145
55
146
@ JsonValue @ Getter private final long id ;
@@ -65,6 +156,7 @@ public enum COSEAlgorithmIdentifier {
65
156
* COSEAlgorithmIdentifier}
66
157
* @return The {@link COSEAlgorithmIdentifier} instance whose {@link #getId() id} equals <code>id
67
158
* </code>, if any.
159
+ * @since 0.3.0
68
160
* @see <a href="https://www.w3.org/TR/2021/REC-webauthn-2-20210408/#sctn-alg-identifier">§5.8.5.
69
161
* Cryptographic Algorithm Identifier (typedef COSEAlgorithmIdentifier)</a>
70
162
*/
@@ -80,6 +172,7 @@ public static Optional<COSEAlgorithmIdentifier> fromId(long id) {
80
172
* COSEAlgorithmIdentifier}, if possible. Returns empty if the {@link COSEAlgorithmIdentifier}
81
173
* enum has no constant matching the <code>alg</code> value.
82
174
* @throws IllegalArgumentException if <code>publicKeyCose</code> is not a well-formed COSE_Key.
175
+ * @since 2.1.0
83
176
*/
84
177
public static Optional <COSEAlgorithmIdentifier > fromPublicKey (@ NonNull ByteArray publicKeyCose ) {
85
178
final CBORObject ALG = CBORObject .FromObject (3 );
0 commit comments