【问题标题】:how to compress and decompress xml present in URL C++如何压缩和解压缩 URL C++ 中的 xml
【发布时间】:2018-05-07 05:51:22
【问题描述】:

我用 C++ 编写了 saml SP,但不知道如何压缩 xml。

http://acme.com:16006/idp/samlv20?SAMLRequest={xmlCompressedandBase64encodedString}

现在xmlCompressedandBase64encodedString 是有问题的部分,我知道 Base64 编码,但 xml 压缩我不知道。

我的 saml 请求将如下所示:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <samlp:AuthnRequest 
        xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"
        xmlns:enc="http://www.w3.org/2001/04/xmlenc#" 
        xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" 
        xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" 
        xmlns:x500="urn:oasis:names:tc:SAML:2.0:profiles:attribute:X500" 
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
        ProtocolBinding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" 
        ID="id-_Abcd1234&-rQjG" 
        Version="2.0" 
        IssueInstant="2018-05-03T06:02:22Z" 
        Destination="http://acme.com:16006/idp/samlv20">
    <saml:Issuer Format="urn:oasis:names:tc:SAML:2.0:nameid-format:entity">
            https://flight.com::14213/sp
    </saml:Issuer>
    <samlp:NameIDPolicy AllowCreate="true"/>

    </samlp:AuthnRequest>

SamlRespone 的解压也是如此。

【问题讨论】:

    标签: c++ xml saml


    【解决方案1】:

    有一个wikipedia article表示你应该使用DEFLATE算法。

    zlib 是最著名的实现 DEFLATE 算法的库之一。我听说 Boost.iostream 也可以使用 zlib 作为依赖项来做到这一点,但我不确定。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-07-06
      • 1970-01-01
      • 2011-11-15
      • 2021-02-09
      • 1970-01-01
      • 1970-01-01
      • 2019-01-29
      • 1970-01-01
      相关资源
      最近更新 更多