@@ -53,22 +53,21 @@ impl PemEncodedKey {
53
53
pub fn new ( input : & [ u8 ] ) -> Result < PemEncodedKey > {
54
54
match pem:: parse ( input) {
55
55
Ok ( content) => {
56
- let pem_contents = content. contents ;
57
- let asn1_content = match simple_asn1:: from_der ( pem_contents. as_slice ( ) ) {
56
+ let asn1_content = match simple_asn1:: from_der ( content. contents ( ) ) {
58
57
Ok ( asn1) => asn1,
59
58
Err ( _) => return Err ( ErrorKind :: InvalidKeyFormat . into ( ) ) ,
60
59
} ;
61
60
62
- match content. tag . as_ref ( ) {
61
+ match content. tag ( ) . as_ref ( ) {
63
62
// This handles a PKCS#1 RSA Private key
64
63
"RSA PRIVATE KEY" => Ok ( PemEncodedKey {
65
- content : pem_contents ,
64
+ content : content . into_contents ( ) ,
66
65
asn1 : asn1_content,
67
66
pem_type : PemType :: RsaPrivate ,
68
67
standard : Standard :: Pkcs1 ,
69
68
} ) ,
70
69
"RSA PUBLIC KEY" => Ok ( PemEncodedKey {
71
- content : pem_contents ,
70
+ content : content . into_contents ( ) ,
72
71
asn1 : asn1_content,
73
72
pem_type : PemType :: RsaPublic ,
74
73
standard : Standard :: Pkcs1 ,
@@ -107,7 +106,7 @@ impl PemEncodedKey {
107
106
}
108
107
} ;
109
108
Ok ( PemEncodedKey {
110
- content : pem_contents ,
109
+ content : content . into_contents ( ) ,
111
110
asn1 : asn1_content,
112
111
pem_type,
113
112
standard : Standard :: Pkcs8 ,
0 commit comments