pub fn add_assertion_signature<W: Write>(
    attr: &crate::assertion::Assertion,
    digest: String,
    base64_encoded_signature: String,
    writer: &mut EventWriter<W>,
) {
    write_event(
        XmlEvent::start_element(("ds", "Signature"))
            .attr("xmlns:ds", "http://www.w3.org/2000/09/xmldsig#")
            .into(),
        writer,
    );

    generate_signedinfo(attr, &digest, writer);

    // start ds:SignatureValue
    write_event(
        XmlEvent::start_element(("ds", "SignatureValue")).into(),
        writer,
    );

    write_event(XmlEvent::characters(&base64_encoded_signature), writer);
    // characters
    // end ds:SignatureValue
    write_event(XmlEvent::end_element().into(), writer);

    // start ds:KeyInfo
    write_event(XmlEvent::start_element(("ds", "KeyInfo")).into(), writer);
    // start ds:X509Data
    write_event(XmlEvent::start_element(("ds", "X509Data")).into(), writer);
    // start ds:X509Certificate
    write_event(
        XmlEvent::start_element(("ds", "X509Certificate")).into(),
        writer,
    );

    let mut stripped_cert = attr.signing_cert.clone().unwrap().get_as_pem_string(false);
    // TODO: is this terrible, or is this terrible? It's terrible, find a better way of cleaning this up.
    stripped_cert = stripped_cert
        .replace("\r\n", "")
        .replace("\n", "")
        .replace(" ", "");
    write_event(XmlEvent::characters(&stripped_cert), writer);
    // end ds:X509Certificate
    write_event(XmlEvent::end_element().into(), writer);
    // end ds:X509Data
    write_event(XmlEvent::end_element().into(), writer);
    // end ds:KeyInfo
    write_event(XmlEvent::end_element().into(), writer);

    //end ds:Signature
    write_event(XmlEvent::end_element().into(), writer);
}
/// add a signature to the statement
add a signature to the statement
add a signature to the statement
pub fn add_assertion_signature<W: Write>(
    attr: &crate::assertion::Assertion,
    digest: String,
    base64_encoded_signature: String,
    writer: &mut EventWriter<W>,
) {
    write_event(
        XmlEvent::start_element(("ds", "Signature"))
            .attr("xmlns:ds", "http://www.w3.org/2000/09/xmldsig#")
            .into(),
        writer,
    );
    generate_signedinfo(attr, &digest, writer);
    // start ds:SignatureValue
    write_event(
        XmlEvent::start_element(("ds", "SignatureValue")).into(),
        writer,
    );
    write_event(XmlEvent::characters(&base64_encoded_signature), writer);
    // characters
    // end ds:SignatureValue
    write_event(XmlEvent::end_element().into(), writer);
    // start ds:KeyInfo
    write_event(XmlEvent::start_element(("ds", "KeyInfo")).into(), writer);
    // start ds:X509Data
    write_event(XmlEvent::start_element(("ds", "X509Data")).into(), writer);
    // start ds:X509Certificate
    write_event(
        XmlEvent::start_element(("ds", "X509Certificate")).into(),
        writer,
    );
    let mut stripped_cert = attr.signing_cert.clone().unwrap().get_as_pem_string(false);
    // TODO: is this terrible, or is this terrible? It's terrible, find a better way of cleaning this up.
    stripped_cert = stripped_cert
        .replace("\r\n", "")
        .replace("\n", "")
        .replace(" ", "");
    write_event(XmlEvent::characters(&stripped_cert), writer);
    // end ds:X509Certificate
    write_event(XmlEvent::end_element().into(), writer);
    // end ds:X509Data
    write_event(XmlEvent::end_element().into(), writer);
    // end ds:KeyInfo
    write_event(XmlEvent::end_element().into(), writer);
    //end ds:Signature
    write_event(XmlEvent::end_element().into(), writer);
}
pub fn add_assertion_signature < W : Write > ( attr : & crate :: assertion :: Assertion , digest : String , base64_encoded_signature : String , writer : & mut EventWriter < W > , ) { write_event ( XmlEvent :: start_element ( ( " " , " " ) ) . attr ( " " , " " ) . into ( ) , writer , ) ; generate_signedinfo ( attr , & digest , writer ) ; // start ds:SignatureValue write_event ( XmlEvent :: start_element ( ( " " , " " ) ) . into ( ) , writer , ) ; write_event ( XmlEvent :: characters ( & base64_encoded_signature ) , writer ) ; // characters // end ds:SignatureValue write_event ( XmlEvent :: end_element ( ) . into ( ) , writer ) ; // start ds:KeyInfo write_event ( XmlEvent :: start_element ( ( " " , " " ) ) . into ( ) , writer ) ; // start ds:X509Data write_event ( XmlEvent :: start_element ( ( " " , " " ) ) . into ( ) , writer ) ; // start ds:X509Certificate write_event ( XmlEvent :: start_element ( ( " " , " " ) ) . into ( ) , writer , ) ; let mut stripped_cert = attr . signing_cert . clone ( ) . unwrap ( ) . get_as_pem_string ( false ) ; // TODO: is this terrible, or is this terrible? It's terrible, find a better way of cleaning this up. stripped_cert = stripped_cert . replace ( " \r \n " , " " ) . replace ( " \n " , " " ) . replace ( " " , " " ) ; write_event ( XmlEvent :: characters ( & stripped_cert ) , writer ) ; // end ds:X509Certificate write_event ( XmlEvent :: end_element ( ) . into ( ) , writer ) ; // end ds:X509Data write_event ( XmlEvent :: end_element ( ) . into ( ) , writer ) ; // end ds:KeyInfo write_event ( XmlEvent :: end_element ( ) . into ( ) , writer ) ; //end ds:Signature write_event ( XmlEvent :: end_element ( ) . into ( ) , writer ) ; }
add a signature to the statement
add a signature to the statement
attr
&crate::assertion::Assertion
digest
String
base64_encoded_signature
String
writer
&mut EventWriter<W>
attr
&crate::assertion::Assertion
digest
String
base64_encoded_signature
String
writer
&mut EventWriter<W>