[control] Tests first: Domi CA flows through the API (offline-signed intermediate, domi host chains, device approval by code, one-time install, revocation, no root key) and UI sign-in that refuses a forged Remote-User (red)
This commit is contained in:
@@ -566,6 +566,15 @@ pub fn match_code(request: &[u8]) -> String {
|
||||
)
|
||||
}
|
||||
|
||||
/// SubjectPublicKeyInfo DER of a CSR (to match a signed certificate to its request).
|
||||
pub fn csr_public_key_der(csr_pem: &str) -> Result<Vec<u8>, PkiError> {
|
||||
use x509_parser::prelude::FromDer;
|
||||
let der = csr_der(csr_pem)?;
|
||||
let (_, csr) = x509_parser::certification_request::X509CertificationRequest::from_der(&der)
|
||||
.map_err(|_| PkiError::BadCsr)?;
|
||||
Ok(csr.certification_request_info.subject_pki.raw.to_vec())
|
||||
}
|
||||
|
||||
/// DER of the first PEM block of a CSR (for the match code).
|
||||
pub fn csr_der(csr_pem: &str) -> Result<Vec<u8>, PkiError> {
|
||||
for p in x509_parser::pem::Pem::iter_from_buffer(csr_pem.as_bytes()) {
|
||||
|
||||
Reference in New Issue
Block a user