File tree Expand file tree Collapse file tree 1 file changed +14
-6
lines changed
anchor/common/ssv_types/src Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -5,14 +5,23 @@ use thiserror::Error;
55/// Errors that can occur during RSA key parsing
66#[ derive( Error , Debug , Clone ) ]
77pub enum RsaParseError {
8- #[ error( "Unable to decode base64 PEM data: {0}" ) ]
9- Base64Decode ( #[ from] base64:: DecodeError ) ,
8+ #[ error( "Unable to decode base64 PEM data: {source}" ) ]
9+ Base64Decode {
10+ #[ from]
11+ #[ source]
12+ source : base64:: DecodeError ,
13+ } ,
1014
11- #[ error( "Unable to convert decoded PEM data into a string: {0}" ) ]
12- Utf8Conversion ( #[ from] std:: string:: FromUtf8Error ) ,
15+ #[ error( "Unable to convert decoded PEM data into a string: {source}" ) ]
16+ Utf8Conversion {
17+ #[ from]
18+ #[ source]
19+ source : std:: string:: FromUtf8Error ,
20+ } ,
1321
1422 #[ error( "Failed to parse RSA public key: {source}" ) ]
1523 RsaParsing {
24+ #[ from]
1625 #[ source]
1726 source : openssl:: error:: ErrorStack ,
1827 } ,
@@ -35,8 +44,7 @@ pub fn parse_rsa(pem_data: &str) -> Result<Rsa<Public>, RsaParseError> {
3544 . replace ( "-----END RSA PUBLIC KEY-----" , "-----END PUBLIC KEY-----" ) ;
3645
3746 // Parse the PEM string into an RSA public key using PKCS8 format
38- let rsa_pubkey = Rsa :: public_key_from_pem ( pem_string. as_bytes ( ) )
39- . map_err ( |source| RsaParseError :: RsaParsing { source } ) ?;
47+ let rsa_pubkey = Rsa :: public_key_from_pem ( pem_string. as_bytes ( ) ) ?;
4048
4149 Ok ( rsa_pubkey)
4250}
You can’t perform that action at this time.
0 commit comments