public override byte[] DecryptKey(string algorithmUri, byte[] keyData)
        {
            AsymmetricKeyExchangeDeformatter deformatter;
            switch (algorithmUri)
            {
                case "http://www.w3.org/2001/04/xmlenc#rsa-1_5":
                    deformatter = new InfoCardRSAPKCS1KeyExchangeDeformatter(this.m_rsa);
                    return deformatter.DecryptKeyExchange(keyData);

                case "http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p":
                    deformatter = new InfoCardRSAOAEPKeyExchangeDeformatter(this.m_rsa);
                    return deformatter.DecryptKeyExchange(keyData);
            }
            throw InfoCardTrace.ThrowHelperError(new NotSupportedException(Microsoft.InfoCards.SR.GetString("ClientUnsupportedCryptoAlgorithm", new object[] { algorithmUri })));
        }
コード例 #2
0
        public override byte[] DecryptKey(string algorithmUri, byte[] keyData)
        {
            AsymmetricKeyExchangeDeformatter deformatter;

            switch (algorithmUri)
            {
            case "http://www.w3.org/2001/04/xmlenc#rsa-1_5":
                deformatter = new InfoCardRSAPKCS1KeyExchangeDeformatter(this.m_rsa);
                return(deformatter.DecryptKeyExchange(keyData));

            case "http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p":
                deformatter = new InfoCardRSAOAEPKeyExchangeDeformatter(this.m_rsa);
                return(deformatter.DecryptKeyExchange(keyData));
            }
            throw InfoCardTrace.ThrowHelperError(new NotSupportedException(Microsoft.InfoCards.SR.GetString("ClientUnsupportedCryptoAlgorithm", new object[] { algorithmUri })));
        }
コード例 #3
0
        //
        // Summary:
        //  Decrypts a symmetric key using the private key of a public/private key pair.
        //
        // Parameters:
        //  algorithmUri  - The algorithm to use to decrypt the key.
        //  keyData       - the key to decrypt.
        //
        public override byte[] DecryptKey(string algorithmUri, byte[] keyData)
        {
            AsymmetricKeyExchangeDeformatter deformatter;

            switch (algorithmUri)
            {
            case EncryptedXml.XmlEncRSA15Url:

                deformatter = new InfoCardRSAPKCS1KeyExchangeDeformatter(m_rsa);
                return(deformatter.DecryptKeyExchange(keyData));

            case EncryptedXml.XmlEncRSAOAEPUrl:

                deformatter = new InfoCardRSAOAEPKeyExchangeDeformatter(m_rsa);
                return(deformatter.DecryptKeyExchange(keyData));

            default:
                throw IDT.ThrowHelperError(new NotSupportedException(SR.GetString(SR.ClientUnsupportedCryptoAlgorithm, algorithmUri)));
            }
        }
コード例 #4
0
        //
        // Summary:
        //  Decrypts a symmetric key using the private key of a public/private key pair.
        //
        // Parameters:
        //  algorithmUri  - The algorithm to use to decrypt the key.
        //  keyData       - the key to decrypt.
        //
        public override byte[] DecryptKey(string algorithmUri, byte[] keyData)
        {
            AsymmetricKeyExchangeDeformatter deformatter;

            switch (algorithmUri)
            {
                case EncryptedXml.XmlEncRSA15Url:

                    deformatter = new InfoCardRSAPKCS1KeyExchangeDeformatter(m_rsa);
                    return deformatter.DecryptKeyExchange(keyData);

                case EncryptedXml.XmlEncRSAOAEPUrl:

                    deformatter = new InfoCardRSAOAEPKeyExchangeDeformatter(m_rsa);
                    return deformatter.DecryptKeyExchange(keyData);

                default:
                    throw IDT.ThrowHelperError(new NotSupportedException(SR.GetString(SR.ClientUnsupportedCryptoAlgorithm, algorithmUri)));
            }
        }