Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/perl/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php PingIdentity SAML2.0 EncryptedAssertion--解密密码数据时出现问题_Php_Saml 2.0 - Fatal编程技术网

Php PingIdentity SAML2.0 EncryptedAssertion--解密密码数据时出现问题

Php PingIdentity SAML2.0 EncryptedAssertion--解密密码数据时出现问题,php,saml-2.0,Php,Saml 2.0,我正在开发一个SSO解决方案,该解决方案必须接收SAML2.0断言才能让用户登录。这在断言需要加密数据之前一直有效。断言响应如下所示(删除了一些信息): $result将为FALSE,$decrypted为NULL。我已经用公钥加密了数据,并用私钥成功解密了数据,因此我相信包含它们的X.509证书是有效的。有人能解释一下吗?提前谢谢。我在这里解决了这个问题。在解密之前,我需要对密码密钥和密码数据进行base64_解码 <samlp:Response IssueInstant="2013-0

我正在开发一个SSO解决方案,该解决方案必须接收SAML2.0断言才能让用户登录。这在断言需要加密数据之前一直有效。断言响应如下所示(删除了一些信息):


$result
将为FALSE,
$decrypted
为NULL。我已经用公钥加密了数据,并用私钥成功解密了数据,因此我相信包含它们的X.509证书是有效的。有人能解释一下吗?提前谢谢。

我在这里解决了这个问题。在解密之前,我需要对密码密钥和密码数据进行base64_解码

<samlp:Response IssueInstant="2013-07-09T21:00:22.884Z" ID="..." Version="2.0" xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol">
    <saml:Issuer xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">...</saml:Issuer>
    <samlp:Status>
        <samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success"/>
    </samlp:Status>
    <saml:EncryptedAssertion xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">
        <xenc:EncryptedData Type="http://www.w3.org/2001/04/xmlenc#Element" xmlns:xenc="http://www.w3.org/2001/04/xmlenc#">
            <xenc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#aes128-cbc"/>
            <ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
                <xenc:EncryptedKey xmlns:xenc="http://www.w3.org/2001/04/xmlenc#">
                    <xenc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5"/>
                    <xenc:CipherData>
                        <xenc:CipherValue>BB9KCO...gRGc7w03zZ5Q==</xenc:CipherValue>
                    </xenc:CipherData>
                </xenc:EncryptedKey>
            </ds:KeyInfo>
            <xenc:CipherData>
                <xenc:CipherValue>kb/HpNix...TcvxjypM</xenc:CipherValue>
            </xenc:CipherData>
        </xenc:EncryptedData>
    </saml:EncryptedAssertion>
</samlp:Response>
$data ='....'; //Contains the EncryptedKey cipherdata
$privateKey = '....'; //Contains the private key
$decrypted = null; //destination for decrypted data
$result = openssl_private_decrypt($data, $decrypted, $privateKey);