mirror of
https://github.com/valmojr/armatak.git
synced 2026-08-18 16:02:58 +00:00
Remove unreachable PEM normalization branch
This commit is contained in:
@@ -44,11 +44,7 @@ pub(crate) fn parse_enrollment_config(xml: &str) -> EnrollmentConfig {
|
|||||||
pub(crate) fn normalize_certificate_pem(certificate: &str) -> String {
|
pub(crate) fn normalize_certificate_pem(certificate: &str) -> String {
|
||||||
let trimmed = certificate.trim();
|
let trimmed = certificate.trim();
|
||||||
if trimmed.contains("-----BEGIN CERTIFICATE-----") {
|
if trimmed.contains("-----BEGIN CERTIFICATE-----") {
|
||||||
if trimmed.ends_with('\n') {
|
|
||||||
trimmed.to_string()
|
|
||||||
} else {
|
|
||||||
format!("{}\n", trimmed)
|
format!("{}\n", trimmed)
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
wrap_pem_body(
|
wrap_pem_body(
|
||||||
trimmed,
|
trimmed,
|
||||||
@@ -191,7 +187,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn preserves_existing_pem_and_adds_trailing_newline_when_needed() {
|
fn preserves_existing_pem_and_adds_a_single_trailing_newline() {
|
||||||
let with_newline =
|
let with_newline =
|
||||||
"-----BEGIN CERTIFICATE-----\nQUJD\n-----END CERTIFICATE-----\n";
|
"-----BEGIN CERTIFICATE-----\nQUJD\n-----END CERTIFICATE-----\n";
|
||||||
let without_newline = "-----BEGIN CERTIFICATE-----\nQUJD\n-----END CERTIFICATE-----";
|
let without_newline = "-----BEGIN CERTIFICATE-----\nQUJD\n-----END CERTIFICATE-----";
|
||||||
|
|||||||
Reference in New Issue
Block a user