0

ユーザーがログインするために SAML2.0 アサーションを受信する必要がある SSO ソリューションに取り組んでいます。これは、アサーションが暗号化されたデータを必要とするまで機能していました。アサーション レスポンスは次のようになります (一部の情報は省略されています)。

<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>

ご覧のとおり、暗号化されたキーと暗号化されたデータがあります。彼らには、暗号化に使用する公開鍵を抽出するための証明書が与えられました。私の理解では、秘密鍵を使用してEncryptedKeyを復号化し、その鍵を使用してEncryptedDataを復号化します。しかし、復号化は引き続き失敗します。

私はこのようにテストしていました:

$data ='....'; //Contains the EncryptedKey cipherdata
$privateKey = '....'; //Contains the private key
$decrypted = null; //destination for decrypted data
$result = openssl_private_decrypt($data, $decrypted, $privateKey);

$resultFALSE になり、$decryptedNULL になります。私は公開鍵でデータを暗号化し、秘密鍵で復号化に成功したので、それらを含む X.509 証明書が有効であると確信しています。誰かがこれに光を当てることができますか? 前もって感謝します。

4

1 に答える 1