Skip to content
This repository was archived by the owner on Aug 19, 2025. It is now read-only.

Commit e5410e3

Browse files
committed
Add additional test for EC keys of both formats
1 parent 9471c1e commit e5410e3

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

tests/integration.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,26 @@ fn smoketest_iterate() {
6565
assert_eq!(count, 16);
6666
}
6767

68+
#[test]
69+
fn test_sec1_vs_pkcs8() {
70+
{
71+
let data = include_bytes!("data/nistp256key.pem");
72+
let mut reader = BufReader::new(&data[..]);
73+
74+
let items = rustls_pemfile::read_all(&mut reader).unwrap();
75+
assert!(matches!(items[0], rustls_pemfile::Item::ECKey(_)));
76+
println!("sec1 {:?}", items);
77+
}
78+
{
79+
let data = include_bytes!("data/nistp256key.pkcs8.pem");
80+
let mut reader = BufReader::new(&data[..]);
81+
82+
let items = rustls_pemfile::read_all(&mut reader).unwrap();
83+
assert!(matches!(items[0], rustls_pemfile::Item::PKCS8Key(_)));
84+
println!("p8 {:?}", items);
85+
}
86+
}
87+
6888
#[test]
6989
fn parse_in_order() {
7090
let data = include_bytes!("data/zen.pem");

0 commit comments

Comments
 (0)