Harden reusable keychain API
This commit is contained in:
parent
4013c868aa
commit
b6ffcde54c
6 changed files with 410 additions and 33 deletions
|
|
@ -10505,20 +10505,29 @@ fn verify_keychain_sigchain_with_ssh(
|
|||
store: &Store,
|
||||
node: &LocalNode,
|
||||
) -> Result<geth_keychain::KeychainSigchainReport, NodeError> {
|
||||
let ops = load_keychain_ops(store)?;
|
||||
let signatures = load_keychain_signatures(store)?;
|
||||
Ok(geth_keychain::verify_sigchain(
|
||||
&ops,
|
||||
&signatures,
|
||||
&|op, signature| {
|
||||
struct SshKeychainVerifier<'a> {
|
||||
node: &'a LocalNode,
|
||||
}
|
||||
|
||||
impl geth_keychain::KeychainSignatureVerifier for SshKeychainVerifier<'_> {
|
||||
fn verify_keychain_signature(
|
||||
&self,
|
||||
op: &KeychainOp,
|
||||
signature: &KeychainOpSignature,
|
||||
) -> bool {
|
||||
verify_keychain_signature_with_ssh(
|
||||
node,
|
||||
self.node,
|
||||
op,
|
||||
&stored_keychain_signature_from_signature(signature),
|
||||
)
|
||||
.unwrap_or(false)
|
||||
},
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
let ops = load_keychain_ops(store)?;
|
||||
let signatures = load_keychain_signatures(store)?;
|
||||
let verifier = SshKeychainVerifier { node };
|
||||
Ok(geth_keychain::verify_sigchain(&ops, &signatures, &verifier))
|
||||
}
|
||||
|
||||
fn store_and_sign_keychain_ops(
|
||||
|
|
|
|||
Loading…
Reference in a new issue