@@ -35,22 +35,20 @@ impl fmt::Display for TlsError {
35
35
36
36
impl std:: error:: Error for TlsError { }
37
37
38
- impl Certificate {
39
- pub ( crate ) fn parse ( & self ) -> Result < Vec < CertificateDer < ' static > > , TlsError > {
40
- rustls_pemfile :: certs ( & mut Cursor :: new ( & self . pem ) )
41
- . collect :: < Result < Vec < _ > , _ > > ( )
42
- . map_err ( |_| TlsError :: CertificateParseError )
43
- }
38
+ pub ( crate ) fn convert_certificate_to_pki_types (
39
+ certificate : & Certificate ,
40
+ ) -> Result < Vec < CertificateDer < ' static > > , TlsError > {
41
+ rustls_pemfile :: certs ( & mut Cursor :: new ( certificate ) )
42
+ . collect :: < Result < Vec < _ > , _ > > ( )
43
+ . map_err ( |_| TlsError :: CertificateParseError )
44
44
}
45
45
46
- impl Identity {
47
- pub ( crate ) fn parse (
48
- & self ,
49
- ) -> Result < ( Vec < CertificateDer < ' static > > , PrivateKeyDer < ' static > ) , TlsError > {
50
- let cert = self . cert . parse ( ) ?;
51
- let Ok ( Some ( key) ) = rustls_pemfile:: private_key ( & mut Cursor :: new ( & self . key ) ) else {
52
- return Err ( TlsError :: PrivateKeyParseError ) ;
53
- } ;
54
- Ok ( ( cert, key) )
55
- }
46
+ pub ( crate ) fn convert_identity_to_pki_types (
47
+ identity : & Identity ,
48
+ ) -> Result < ( Vec < CertificateDer < ' static > > , PrivateKeyDer < ' static > ) , TlsError > {
49
+ let cert = convert_certificate_to_pki_types ( & identity. cert ) ?;
50
+ let Ok ( Some ( key) ) = rustls_pemfile:: private_key ( & mut Cursor :: new ( & identity. key ) ) else {
51
+ return Err ( TlsError :: PrivateKeyParseError ) ;
52
+ } ;
53
+ Ok ( ( cert, key) )
56
54
}
0 commit comments