Explicitly set policy when calling util::upload_subkeys()
This commit is contained in:
parent
773117965c
commit
56e3845ea4
2 changed files with 7 additions and 4 deletions
|
@ -7,6 +7,7 @@ use std::string::FromUtf8Error;
|
||||||
use thiserror;
|
use thiserror;
|
||||||
|
|
||||||
use sequoia_openpgp::parse::Parse;
|
use sequoia_openpgp::parse::Parse;
|
||||||
|
use sequoia_openpgp::policy::{NullPolicy, StandardPolicy};
|
||||||
use sequoia_openpgp::serialize::SerializeInto;
|
use sequoia_openpgp::serialize::SerializeInto;
|
||||||
use sequoia_openpgp::Cert;
|
use sequoia_openpgp::Cert;
|
||||||
|
|
||||||
|
@ -192,7 +193,9 @@ pub fn test_upload_keys(
|
||||||
|
|
||||||
let cert = Cert::from_file(param[0])?;
|
let cert = Cert::from_file(param[0])?;
|
||||||
|
|
||||||
let meta = util::upload_subkeys(ca, &cert)
|
let p = StandardPolicy::new();
|
||||||
|
|
||||||
|
let meta = util::upload_subkeys(ca, &cert, &p)
|
||||||
.map_err(|e| TestError::KeyUploadError(param[0].to_string(), e))?;
|
.map_err(|e| TestError::KeyUploadError(param[0].to_string(), e))?;
|
||||||
|
|
||||||
check_key_upload_metadata(ca, &meta)?;
|
check_key_upload_metadata(ca, &meta)?;
|
||||||
|
|
|
@ -10,7 +10,7 @@ use sequoia_openpgp::parse::stream::{
|
||||||
VerificationHelper,
|
VerificationHelper,
|
||||||
};
|
};
|
||||||
use sequoia_openpgp::parse::Parse;
|
use sequoia_openpgp::parse::Parse;
|
||||||
use sequoia_openpgp::policy::StandardPolicy;
|
use sequoia_openpgp::policy::{Policy, StandardPolicy};
|
||||||
use sequoia_openpgp::serialize::stream::{
|
use sequoia_openpgp::serialize::stream::{
|
||||||
Armorer, Encryptor, LiteralWriter, Message,
|
Armorer, Encryptor, LiteralWriter, Message,
|
||||||
};
|
};
|
||||||
|
@ -26,6 +26,7 @@ pub const SP: &StandardPolicy = &StandardPolicy::new();
|
||||||
pub(crate) fn upload_subkeys(
|
pub(crate) fn upload_subkeys(
|
||||||
ca: &mut CardApp,
|
ca: &mut CardApp,
|
||||||
cert: &Cert,
|
cert: &Cert,
|
||||||
|
policy: &dyn Policy,
|
||||||
) -> Result<Vec<(String, KeyGenerationTime)>> {
|
) -> Result<Vec<(String, KeyGenerationTime)>> {
|
||||||
let mut out = vec![];
|
let mut out = vec![];
|
||||||
|
|
||||||
|
@ -34,8 +35,7 @@ pub(crate) fn upload_subkeys(
|
||||||
KeyType::Decryption,
|
KeyType::Decryption,
|
||||||
KeyType::Authentication,
|
KeyType::Authentication,
|
||||||
] {
|
] {
|
||||||
let sp = StandardPolicy::new();
|
let vka = get_subkey(cert, policy, *kt)?;
|
||||||
let vka = get_subkey(cert, &sp, *kt)?;
|
|
||||||
|
|
||||||
// store fingerprint as return-value
|
// store fingerprint as return-value
|
||||||
let fp = vka.fingerprint().to_hex();
|
let fp = vka.fingerprint().to_hex();
|
||||||
|
|
Loading…
Reference in a new issue