Skip to content

Commit

Permalink
Use rsaEncryption OID for RSA keys
Browse files Browse the repository at this point in the history
  • Loading branch information
jschanck committed Sep 4, 2024
1 parent b04ce2f commit d611d68
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/crypto/der.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<T> = std::result::Result<T, CryptoError>;
Expand Down
8 changes: 4 additions & 4 deletions src/crypto/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()?,
])?,
Expand Down Expand Up @@ -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 {
Expand All @@ -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,
Expand Down

0 comments on commit d611d68

Please sign in to comment.