Skip to content

Commit 2e85346

Browse files
committed
Use rsaEncryption OID for RSA keys
1 parent b04ce2f commit 2e85346

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/crypto/der.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ pub const OID_SECP256R1_BYTES: &[u8] = &[
1818
0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07,
1919
];
2020
pub const OID_ED25519_BYTES: &[u8] = &[/* RFC 8410 (id-ed25519) */ 0x2b, 0x65, 0x70];
21-
pub const OID_RS256_BYTES: &[u8] = &[
22-
/* RFC 4055 (sha256WithRSAEncryption) */
23-
0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0b,
21+
pub const OID_RSA_ENCRYPTION_BYTES: &[u8] = &[
22+
/* RFC 4055 (rsaEncryption) */
23+
0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01,
2424
];
2525

2626
pub type Result<T> = std::result::Result<T, CryptoError>;

src/crypto/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -823,7 +823,7 @@ impl COSERSAKey {
823823
// algorithm: AlgorithmIdentifier
824824
&der::sequence(&[
825825
// algorithm
826-
&der::object_id(der::OID_RS256_BYTES)?,
826+
&der::object_id(der::OID_RSA_ENCRYPTION_BYTES)?,
827827
// parameters
828828
&der::null()?,
829829
])?,
@@ -1246,8 +1246,8 @@ mod test {
12461246
// $ ascii2der | xxd -i
12471247
// SEQUENCE {
12481248
// SEQUENCE {
1249-
// # sha256WithRSAEncryption
1250-
// OBJECT_IDENTIFIER { 1.2.840.113549.1.1.11 }
1249+
// # rsaEncryption
1250+
// OBJECT_IDENTIFIER { 1.2.840.113549.1.1.1 }
12511251
// NULL {}
12521252
// }
12531253
// BIT_STRING {
@@ -1260,7 +1260,7 @@ mod test {
12601260
// }
12611261
let expected: &[u8] = &[
12621262
0x30, 0x82, 0x01, 0x22, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d,
1263-
0x01, 0x01, 0x0b, 0x05, 0x00, 0x03, 0x82, 0x01, 0x0f, 0x00, 0x30, 0x82, 0x01, 0x0a,
1263+
0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x0f, 0x00, 0x30, 0x82, 0x01, 0x0a,
12641264
0x02, 0x82, 0x01, 0x01, 0x00, 0xd4, 0xd2, 0x53, 0xed, 0x7a, 0x69, 0xb1, 0x84, 0xc9,
12651265
0xfb, 0x70, 0x30, 0x0c, 0x51, 0xb1, 0x8f, 0x89, 0x6c, 0xb1, 0x31, 0x6d, 0x87, 0xbe,
12661266
0xe1, 0xc7, 0xf7, 0xb0, 0x4f, 0xe7, 0x27, 0xa7, 0xb7, 0x7c, 0x55, 0x20, 0x37, 0xa8,

0 commit comments

Comments
 (0)