| 1 |
#[cfg(test)] |
| 2 |
mod integration { |
| 3 |
use assert_cmd::Command; |
| 4 |
use std::path; |
| 5 |
|
| 6 |
#[test] |
| 7 |
fn not_for_signing_subkey() { |
| 8 |
Command::cargo_bin("sqv").expect("have sqv") |
| 9 |
.current_dir(path::Path::new("tests").join("data")) |
| 10 |
.args( |
| 11 |
&["--keyring", |
| 12 |
&"no-signing-caps.key", |
| 13 |
&"no-signing-caps.sig", |
| 14 |
&"msg.txt"]) |
| 15 |
.assert() |
| 16 |
.failure(); |
| 17 |
} |
| 18 |
} |
| 19 |
|
| 20 |
// Code to create the data for the test cases above |
| 21 |
// use sequoia_openpgp; |
| 22 |
// |
| 23 |
// #[test] |
| 24 |
// fn create_key() { |
| 25 |
// use std::fs::File; |
| 26 |
// use sequoia_openpgp::{ |
| 27 |
// cert::CertBuilder, |
| 28 |
// packet::{ |
| 29 |
// signature, |
| 30 |
// key::SecretKey, |
| 31 |
// }, |
| 32 |
// crypto::KeyPair, |
| 33 |
// serialize::Serialize, |
| 34 |
// types::{ |
| 35 |
// SignatureType, |
| 36 |
// HashAlgorithm, |
| 37 |
// } |
| 38 |
// }; |
| 39 |
// |
| 40 |
// let (cert, _) = CertBuilder::default() |
| 41 |
// .add_userid("Testy Mc Test") |
| 42 |
// .add_transport_encryption_subkey() |
| 43 |
// .generate().unwrap(); |
| 44 |
// let subkey = cert.subkeys().next().unwrap(); |
| 45 |
// let key = subkey.subkey(); |
| 46 |
// let sig = { |
| 47 |
// let mpis = match key.secret() { |
| 48 |
// Some(SecretKey::Unencrypted{ ref mpis }) => mpis, |
| 49 |
// _ => unreachable!(), |
| 50 |
// }; |
| 51 |
// let mut b = signature::SignatureBuilder::new(SignatureType::Binary); |
| 52 |
// b.sign_message( |
| 53 |
// &mut KeyPair::new(key.clone(), mpis.clone()).unwrap(), |
| 54 |
// HashAlgorithm::SHA512, b"Hello, World").unwrap() |
| 55 |
// }; |
| 56 |
// |
| 57 |
// { |
| 58 |
// let mut fd = File::create("key").unwrap(); |
| 59 |
// cert.serialize(&mut fd).unwrap(); |
| 60 |
// } |
| 61 |
// |
| 62 |
// { |
| 63 |
// let mut fd = File::create("sig").unwrap(); |
| 64 |
// sig.serialize(&mut fd).unwrap(); |
| 65 |
// } |
| 66 |
// } |