3838 * registered in the IANA COSE Algorithms registry, for instance, -7 for "ES256" and -257 for
3939 * "RS256".
4040 *
41+ * @since 0.3.0
4142 * @see <a
4243 * href="https://www.w3.org/TR/2021/REC-webauthn-2-20210408/#typedefdef-cosealgorithmidentifier">§5.10.5.
4344 * Cryptographic Algorithm Identifier (typedef COSEAlgorithmIdentifier)</a>
4445 */
4546public 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+ */
4663 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+ */
4778 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+ */
4893 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+ */
49108 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+ */
50117 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+ */
51126 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+ */
52135 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+ */
53144 RS1 (-65535 );
54145
55146 @ JsonValue @ Getter private final long id ;
@@ -65,6 +156,7 @@ public enum COSEAlgorithmIdentifier {
65156 * COSEAlgorithmIdentifier}
66157 * @return The {@link COSEAlgorithmIdentifier} instance whose {@link #getId() id} equals <code>id
67158 * </code>, if any.
159+ * @since 0.3.0
68160 * @see <a href="https://www.w3.org/TR/2021/REC-webauthn-2-20210408/#sctn-alg-identifier">§5.8.5.
69161 * Cryptographic Algorithm Identifier (typedef COSEAlgorithmIdentifier)</a>
70162 */
@@ -80,6 +172,7 @@ public static Optional<COSEAlgorithmIdentifier> fromId(long id) {
80172 * COSEAlgorithmIdentifier}, if possible. Returns empty if the {@link COSEAlgorithmIdentifier}
81173 * enum has no constant matching the <code>alg</code> value.
82174 * @throws IllegalArgumentException if <code>publicKeyCose</code> is not a well-formed COSE_Key.
175+ * @since 2.1.0
83176 */
84177 public static Optional <COSEAlgorithmIdentifier > fromPublicKey (@ NonNull ByteArray publicKeyCose ) {
85178 final CBORObject ALG = CBORObject .FromObject (3 );
0 commit comments