Skip to content

Commit

Permalink
chore: have CI self-update that test cert...
Browse files Browse the repository at this point in the history
  • Loading branch information
steffengy committed Mar 31, 2023
1 parent 788c615 commit ea4ffcf
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
1 change: 1 addition & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ build: off
test_script:
# TODO remove this loop when server 2016 lands on appveyor; related to https://github.com/steffengy/schannel-rs/issues/8
- set RUST_BACKTRACE=1
- .\update_test_cert.bat
- ps: for($i=1; $i -le 3; $i++) { cmd /c "cargo test 2>&1"; if ($?) { break } }
5 changes: 1 addition & 4 deletions src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,10 +304,7 @@ fn verify_callback_gives_failed_cert() {
let err = tls_stream::Builder::new()
.domain("self-signed.badssl.com")
.verify_callback(|validation_result| {
let expected_finger = vec![
0x31, 0xCF, 0x9F, 0x34, 0x65, 0x7B, 0xF1, 0xA7, 0xA2, 0xAA,
0xB0, 0x4F, 0x46, 0x48, 0x19, 0x42, 0x83, 0x6D, 0x84, 0xE2,
];
let expected_finger = include_bytes!("../test/self-signed.badssl.com.cer.sha1").to_vec();
assert_eq!(
validation_result
.failed_certificate()
Expand Down
2 changes: 2 additions & 0 deletions update_test_cert.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
openssl s_client -showcerts -connect self-signed.badssl.com:443 -servername self-signed.badssl.com <NUL|openssl x509 -outform der -out .\test\self-signed.badssl.com.cer
openssl x509 -noout -fingerprint -sha1 -inform der -in .\test\self-signed.badssl.com.cer 2>&1|powershell.exe -command "Set-Content .\test\self-signed.badssl.com.cer.sha1 -Encoding Byte -Value ([byte[]] -split ($Input.split('=', 2)[1].replace(':', '') -replace '..', '0x$& '))"

0 comments on commit ea4ffcf

Please sign in to comment.