File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -80,26 +80,28 @@ impl GeneratePkcs12 {
8080
8181impl CertInput {
8282 pub fn read ( & self ) -> Result < Vec < X509 > , snafu:: Whatever > {
83- let file_contents = fs:: read ( self . path ( ) )
84- . with_whatever_context ( |_| format ! ( "failed to read file from {self:?}" ) ) ?;
85-
8683 match self {
87- CertInput :: Pem ( _) => {
84+ CertInput :: Pem ( path) => {
85+ let file_contents = fs:: read ( path)
86+ . with_whatever_context ( |_| format ! ( "failed to read file from {self:?}" ) ) ?;
87+
8888 let certs = parse_pem_contents ( & file_contents) . with_whatever_context ( |_| {
8989 format ! (
9090 "failed to parse PEM contents from {path:?}" ,
9191 path = self . path( )
9292 )
9393 } ) ?;
94- let path = self . path ( ) ;
9594 ensure_whatever ! (
9695 !certs. is_empty( ) ,
9796 "The PEM file at {path:?} contained no certificates" ,
9897 ) ;
9998
10099 Ok ( certs)
101100 }
102- CertInput :: Pkcs12 ( Pkcs12Source { password, .. } ) => {
101+ CertInput :: Pkcs12 ( Pkcs12Source { path, password } ) => {
102+ let file_contents = fs:: read ( path)
103+ . with_whatever_context ( |_| format ! ( "failed to read file from {self:?}" ) ) ?;
104+
103105 parse_pkcs12_file_workaround ( & file_contents, password)
104106 }
105107 }
You can’t perform that action at this time.
0 commit comments