From d611d68f653248d3c9bca6574dac2668d3e0d3c1 Mon Sep 17 00:00:00 2001 From: "John M. Schanck" Date: Fri, 30 Aug 2024 13:36:04 -0700 Subject: [PATCH] Use rsaEncryption OID for RSA keys --- src/crypto/der.rs | 6 +++--- src/crypto/mod.rs | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/crypto/der.rs b/src/crypto/der.rs index 39c5e0b6..85aed10c 100644 --- a/src/crypto/der.rs +++ b/src/crypto/der.rs @@ -18,9 +18,9 @@ pub const OID_SECP256R1_BYTES: &[u8] = &[ 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07, ]; pub const OID_ED25519_BYTES: &[u8] = &[/* RFC 8410 (id-ed25519) */ 0x2b, 0x65, 0x70]; -pub const OID_RS256_BYTES: &[u8] = &[ - /* RFC 4055 (sha256WithRSAEncryption) */ - 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0b, +pub const OID_RSA_ENCRYPTION_BYTES: &[u8] = &[ + /* RFC 4055 (rsaEncryption) */ + 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, ]; pub type Result = std::result::Result; diff --git a/src/crypto/mod.rs b/src/crypto/mod.rs index a86dac82..1ad99742 100644 --- a/src/crypto/mod.rs +++ b/src/crypto/mod.rs @@ -823,7 +823,7 @@ impl COSERSAKey { // algorithm: AlgorithmIdentifier &der::sequence(&[ // algorithm - &der::object_id(der::OID_RS256_BYTES)?, + &der::object_id(der::OID_RSA_ENCRYPTION_BYTES)?, // parameters &der::null()?, ])?, @@ -1246,8 +1246,8 @@ mod test { // $ ascii2der | xxd -i // SEQUENCE { // SEQUENCE { - // # sha256WithRSAEncryption - // OBJECT_IDENTIFIER { 1.2.840.113549.1.1.11 } + // # rsaEncryption + // OBJECT_IDENTIFIER { 1.2.840.113549.1.1.1 } // NULL {} // } // BIT_STRING { @@ -1260,7 +1260,7 @@ mod test { // } let expected: &[u8] = &[ 0x30, 0x82, 0x01, 0x22, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, - 0x01, 0x01, 0x0b, 0x05, 0x00, 0x03, 0x82, 0x01, 0x0f, 0x00, 0x30, 0x82, 0x01, 0x0a, + 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x0f, 0x00, 0x30, 0x82, 0x01, 0x0a, 0x02, 0x82, 0x01, 0x01, 0x00, 0xd4, 0xd2, 0x53, 0xed, 0x7a, 0x69, 0xb1, 0x84, 0xc9, 0xfb, 0x70, 0x30, 0x0c, 0x51, 0xb1, 0x8f, 0x89, 0x6c, 0xb1, 0x31, 0x6d, 0x87, 0xbe, 0xe1, 0xc7, 0xf7, 0xb0, 0x4f, 0xe7, 0x27, 0xa7, 0xb7, 0x7c, 0x55, 0x20, 0x37, 0xa8,