aboutsummaryrefslogtreecommitdiff
path: root/openssl/src/ssl/tests
diff options
context:
space:
mode:
authorSteven Fackler <[email protected]>2016-08-02 20:48:42 -0700
committerSteven Fackler <[email protected]>2016-08-02 20:49:28 -0700
commit08e27f31ed851873f7684ac806b837e8cff4a28f (patch)
tree821fcef610a78e42ad116035926c64337a97807e /openssl/src/ssl/tests
parentDrop unused feature gate (diff)
downloadrust-openssl-08e27f31ed851873f7684ac806b837e8cff4a28f.tar.xz
rust-openssl-08e27f31ed851873f7684ac806b837e8cff4a28f.zip
Restructure PEM input/output methods
Dealing with byte buffers directly avoids error handling weirdness and we were loading it all into memory before anyway.
Diffstat (limited to 'openssl/src/ssl/tests')
-rw-r--r--openssl/src/ssl/tests/mod.rs15
1 files changed, 4 insertions, 11 deletions
diff --git a/openssl/src/ssl/tests/mod.rs b/openssl/src/ssl/tests/mod.rs
index 0b638546..b774b383 100644
--- a/openssl/src/ssl/tests/mod.rs
+++ b/openssl/src/ssl/tests/mod.rs
@@ -418,17 +418,10 @@ fn test_write_hits_stream() {
#[test]
fn test_set_certificate_and_private_key() {
- let key_path = Path::new("test/key.pem");
- let cert_path = Path::new("test/cert.pem");
- let mut key_file = File::open(&key_path)
- .ok()
- .expect("Failed to open `test/key.pem`");
- let mut cert_file = File::open(&cert_path)
- .ok()
- .expect("Failed to open `test/cert.pem`");
-
- let key = PKey::private_key_from_pem(&mut key_file).unwrap();
- let cert = X509::from_pem(&mut cert_file).unwrap();
+ let key = include_bytes!("../../../test/key.pem");
+ let key = PKey::private_key_from_pem(key).unwrap();
+ let cert = include_bytes!("../../../test/cert.pem");
+ let cert = X509::from_pem(cert).unwrap();
let mut ctx = SslContext::new(Sslv23).unwrap();
ctx.set_private_key(&key).unwrap();