pub fn der_to_pem(der: &[u8], label: &str) -> String {
    let mut ans = String::from("-----BEGIN ");
    ans.push_str(label);
    ans.push_str("-----\n");
    let b64 = base64::encode(der);
    let line_length = 60;
    for chunk in b64.chars().collect::<Vec<_>>().chunks(line_length) {
        ans.extend(chunk);
        ans.push('\n');
    }
    ans.push_str("-----END ");
    ans.push_str(label);
    ans.push_str("-----\n");
    ans
}
/// Converts DER encoded data to PEM.
Converts DER encoded data to PEM.
Converts DER encoded data to PEM .
pub fn der_to_pem(der: &[u8], label: &str) -> String {
    let mut ans = String::from("-----BEGIN ");
    ans.push_str(label);
    ans.push_str("-----\n");
    let b64 = base64::encode(der);
    let line_length = 60;
    for chunk in b64.chars().collect::<Vec<_>>().chunks(line_length) {
        ans.extend(chunk);
        ans.push('\n');
    }
    ans.push_str("-----END ");
    ans.push_str(label);
    ans.push_str("-----\n");
    ans
}
pub fn der_to_pem ( der : & [ u8 ] , label : & str ) -> String { let mut ans = String :: from ( " " ) ; ans . push_str ( label ) ; ans . push_str ( " \n " ) ; let b64 = base64 :: encode ( der ) ; let line_length = 60 ; for chunk in b64 . chars ( ) . collect :: < Vec < _ > > ( ) . chunks ( line_length ) { ans . extend ( chunk ) ; ans . push ( '\n' ) ; } ans . push_str ( " " ) ; ans . push_str ( label ) ; ans . push_str ( " \n " ) ; ans }
Converts DER encoded data to PEM.
Converts DER encoded data to PEM .
der
&[u8]
label
&str
der
&[u8]
label
&str