forked from parallaxsecond/parsec-tool
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cargo.toml: Temporary patch rcgen crate for RSA-PSS CSR support
RSA-PSS CSR creation functionality has been recently added. For creating the CSRs, we are currently using rcgen. For RSA-PSS, rcgen defined the PKCS_RSA_PSS_SHA256 type, which should be used instead of the currently used one (PKCS_RSA_SHA256). Unfortunately, rcgen does not expose this type as there have been some issues validating the CSR creation of this type. This has been tested using real RSA PSS keys and the functionality works as expected. * Patch rcgen to expose the PKCS_RSA_PSS_SHA256 type. * Use this type in parsec-tool CSR creation for RSA-PSS. Signed-off-by: Tomás González <[email protected]>
- Loading branch information
1 parent
6387589
commit 125cdbc
Showing
6 changed files
with
74 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
/target | ||
*patch | ||
.devcontainer |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
diff --git a/src/lib.rs b/src/lib.rs | ||
index 565b3d6..23998c3 100644 | ||
--- a/src/lib.rs | ||
+++ b/src/lib.rs | ||
@@ -1500,6 +1500,9 @@ impl KeyPair { | ||
} else if alg == &PKCS_RSA_PSS_SHA256 { | ||
let rsakp = RsaKeyPair::from_pkcs8(pkcs8)?; | ||
KeyPairKind::Rsa(rsakp, &signature::RSA_PSS_SHA256) | ||
+ } else if alg == &PKCS_RSA_PSS_SHA384 { | ||
+ let rsakp = RsaKeyPair::from_pkcs8(pkcs8)?; | ||
+ KeyPairKind::Rsa(rsakp, &signature::RSA_PSS_SHA384) | ||
} else { | ||
panic!("Unknown SignatureAlgorithm specified!"); | ||
}; | ||
@@ -1886,6 +1889,7 @@ impl SignatureAlgorithm { | ||
&PKCS_RSA_SHA384, | ||
&PKCS_RSA_SHA512, | ||
//&PKCS_RSA_PSS_SHA256, | ||
+ //&PKCS_RSA_PSS_SHA384, | ||
&PKCS_ECDSA_P256_SHA256, | ||
&PKCS_ECDSA_P384_SHA384, | ||
&PKCS_ED25519 | ||
@@ -1938,17 +1942,32 @@ pub static PKCS_RSA_SHA512 :SignatureAlgorithm = SignatureAlgorithm { | ||
// support those: https://github.com/briansmith/ring/issues/1353 | ||
// | ||
/// RSA signing with PKCS#1 2.1 RSASSA-PSS padding and SHA-256 hashing as per [RFC 4055](https://tools.ietf.org/html/rfc4055) | ||
-static PKCS_RSA_PSS_SHA256 :SignatureAlgorithm = SignatureAlgorithm { | ||
+pub static PKCS_RSA_PSS_SHA256 :SignatureAlgorithm = SignatureAlgorithm { | ||
// We could also use OID_RSA_ENCRYPTION here, but it's recommended | ||
// to use ID-RSASSA-PSS if possible. | ||
oids_sign_alg :&[&OID_RSASSA_PSS], | ||
sign_alg :SignAlgo::Rsa(), | ||
- oid_components : &OID_RSASSA_PSS,//&[1, 2, 840, 113549, 1, 1, 13], | ||
+ oid_components : &OID_RSASSA_PSS,//&[1, 2, 840, 113549, 1, 1, 11], | ||
// rSASSA-PSS-SHA256-Params in RFC 4055 | ||
params : SignatureAlgorithmParams::RsaPss { | ||
// id-sha256 in https://datatracker.ietf.org/doc/html/rfc4055#section-2.1 | ||
hash_algorithm : &[2, 16, 840, 1, 101, 3, 4, 2, 1], | ||
- salt_length : 20, | ||
+ salt_length : 32, | ||
+ }, | ||
+}; | ||
+ | ||
+/// RSA signing with PKCS#1 2.1 RSASSA-PSS padding and SHA-384 hashing as per [RFC 4055](https://tools.ietf.org/html/rfc4055) | ||
+pub static PKCS_RSA_PSS_SHA384 :SignatureAlgorithm = SignatureAlgorithm { | ||
+ // We could also use OID_RSA_ENCRYPTION here, but it's recommended | ||
+ // to use ID-RSASSA-PSS if possible. | ||
+ oids_sign_alg :&[&OID_RSASSA_PSS], | ||
+ sign_alg :SignAlgo::Rsa(), | ||
+ oid_components : &OID_RSASSA_PSS,//&[1, 2, 840, 113549, 1, 1, 12], | ||
+ // rSASSA-PSS-SHA384-Params in RFC 4055 | ||
+ params : SignatureAlgorithmParams::RsaPss { | ||
+ // id-sha384 in https://datatracker.ietf.org/doc/html/rfc4055#section-2.1 | ||
+ hash_algorithm : &[2, 16, 840, 1, 101, 3, 4, 2, 2], | ||
+ salt_length : 32, | ||
}, | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters