Skip to main content

inspect

Function inspect 

Source
pub fn inspect<'a, W: Work>(
    identifier: AlgorithmIdentifier<'a>,
    execution: &W,
) -> Result<Option<Reading<'a>>>
Expand description

Inspects retained PSS parameters through the same kernel as read.

Readable DER DEFAULT spelling faults are retained on the current storage account. All diagnostic admission also obeys the original and current work ceilings. The result can outlive the temporary operation; its fields still borrow the original source and its diagnostic capacity stays charged until dropped. Resource failures never become missing faults or successful absence.

ยงExamples

use std::sync::Arc;
use structured_asn1::{Parser, memory::{Memory, MemoryAccount}};
use structured_pkix::{ErrorCode, algorithm::{self, pss}};
let source = Parser::der(Memory::new(Arc::new(MemoryAccount::new(4096, 4096))));
let bytes = b"\x30\x12\x06\x09\x2a\x86\x48\x86\xf7\x0d\x01\x01\x0a\x30\x05\xa2\x03\x02\x01\x14";
let mut reader = source.read(bytes, 400).unwrap();
let element = reader.next_element().unwrap().unwrap();
let identifier = algorithm::read(&reader, &element, "signatureAlgorithm")?;
let current = Memory::new(Arc::new(MemoryAccount::new(4096, 4096)));
let reading = pss::inspect(identifier, &current)?.unwrap();
assert_eq!(reading.parameters().salt().as_u64(), Some(20));
assert_eq!(reading.faults()[0].code(), ErrorCode::DefaultWritten);