fn replace_tls_certificate_pubkey_with_invalid_one(cert: &mut X509PublicKeyCert) {
    let x509_cert_der = &cert.certificate_der;
    let (_, x509_cert) = x509_parser::parse_x509_certificate(x509_cert_der).unwrap();
    let pubkey_raw = x509_cert
        .tbs_certificate
        .subject_pki
        .subject_public_key
        .data;
    let range_of_pubkey_raw_in_der = range_of_needle_in_haystack(pubkey_raw, x509_cert_der);
    let invalid_pubkey = invalidate_valid_ed25519_pubkey_bytes(pubkey_raw);
    cert.certificate_der
        .splice(range_of_pubkey_raw_in_der, invalid_pubkey.0.iter().copied());
}
/// Replaces the TLS certificate's valid public key with an invalid one.
/// The replacement is done by directly manipulating the DER encoding rather
/// than using a respective API because such an API currently exists neither
/// in the openssl crate nor in the x509_parser crate.
Replaces the TLS certificate's valid public key with an invalid one.
The replacement is done by directly manipulating the DER encoding rather
than using a respective API because such an API currently exists neither
in the openssl crate nor in the x509_parser crate.
Replaces the TLS certificate ' s valid public key with an invalid one . The replacement is done by directly manipulating the DER encoding rather than using a respective API because such an API currently exists neither in the openssl crate nor in the x509_parser crate .
fn replace_tls_certificate_pubkey_with_invalid_one(cert: &mut X509PublicKeyCert) {
    let x509_cert_der = &cert.certificate_der;
    let (_, x509_cert) = x509_parser::parse_x509_certificate(x509_cert_der).unwrap();
    let pubkey_raw = x509_cert
        .tbs_certificate
        .subject_pki
        .subject_public_key
        .data;
    let range_of_pubkey_raw_in_der = range_of_needle_in_haystack(pubkey_raw, x509_cert_der);
    let invalid_pubkey = invalidate_valid_ed25519_pubkey_bytes(pubkey_raw);
    cert.certificate_der
        .splice(range_of_pubkey_raw_in_der, invalid_pubkey.0.iter().copied());
}
fn replace_tls_certificate_pubkey_with_invalid_one ( cert : & mut X509PublicKeyCert ) { let x509_cert_der = & cert . certificate_der ; let ( _ , x509_cert ) = x509_parser :: parse_x509_certificate ( x509_cert_der ) . unwrap ( ) ; let pubkey_raw = x509_cert . tbs_certificate . subject_pki . subject_public_key . data ; let range_of_pubkey_raw_in_der = range_of_needle_in_haystack ( pubkey_raw , x509_cert_der ) ; let invalid_pubkey = invalidate_valid_ed25519_pubkey_bytes ( pubkey_raw ) ; cert . certificate_der . splice ( range_of_pubkey_raw_in_der , invalid_pubkey . 0 . iter ( ) . copied ( ) ) ; }
Replaces the TLS certificate's valid public key with an invalid one.
Replaces the TLS certificate ' s valid public key with an invalid one .
cert
&mut X509PublicKeyCert
cert
&mut X509PublicKeyCert