public override ICryptoTransform GetDecryptionTransform(string algorithmUri, byte[] iv)
        {
            string str;

            if (((str = algorithmUri) != null) && (str == "http://www.w3.org/2001/04/xmlenc#aes128-cbc"))
            {
                using (InfoCardSymmetricAlgorithm algorithm = new InfoCardSymmetricAlgorithm(this.m_cryptoHandle))
                {
                    algorithm.IV = iv;
                    return(algorithm.CreateDecryptor());
                }
            }
            throw InfoCardTrace.ThrowHelperError(new NotSupportedException(Microsoft.InfoCards.SR.GetString("ClientUnsupportedCryptoAlgorithm", new object[] { algorithmUri })));
        }
Ejemplo n.º 2
0
        //
        // Summary:
        //  Returns an ICryptoTransform based on the algorithm and initialization vector passed in and the underlying
        //  CryptoHandle.
        //
        // Parameters:
        //  algorithmUri  - The algorithm that the transform you implement.
        //  iv            - The initialization vector to use in the transform
        //
        public override ICryptoTransform GetDecryptionTransform(string algorithmUri, byte[] iv)
        {
            ICryptoTransform transform;

            switch (algorithmUri)
            {
            case SecurityAlgorithms.Aes128Encryption:
                using (InfoCardSymmetricAlgorithm symAlgo = new InfoCardSymmetricAlgorithm(m_cryptoHandle))
                {
                    symAlgo.IV = iv;
                    transform  = symAlgo.CreateDecryptor();
                }
                break;

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

            return(transform);
        }
 public override ICryptoTransform GetDecryptionTransform(string algorithmUri, byte[] iv)
 {
     string str;
     if (((str = algorithmUri) != null) && (str == "http://www.w3.org/2001/04/xmlenc#aes128-cbc"))
     {
         using (InfoCardSymmetricAlgorithm algorithm = new InfoCardSymmetricAlgorithm(this.m_cryptoHandle))
         {
             algorithm.IV = iv;
             return algorithm.CreateDecryptor();
         }
     }
     throw InfoCardTrace.ThrowHelperError(new NotSupportedException(Microsoft.InfoCards.SR.GetString("ClientUnsupportedCryptoAlgorithm", new object[] { algorithmUri })));
 }
        //
        // Summary:
        //  Returns an ICryptoTransform based on the algorithm and initialization vector passed in and the underlying
        //  CryptoHandle.
        //
        // Parameters:
        //  algorithmUri  - The algorithm that the transform you implement.
        //  iv            - The initialization vector to use in the transform
        //
        public override ICryptoTransform GetDecryptionTransform(string algorithmUri, byte[] iv)
        {
            ICryptoTransform transform;

            switch (algorithmUri)
            {
                case SecurityAlgorithms.Aes128Encryption:
                    using (InfoCardSymmetricAlgorithm symAlgo = new InfoCardSymmetricAlgorithm(m_cryptoHandle))
                    {
                        symAlgo.IV = iv;
                        transform = symAlgo.CreateDecryptor();
                    }
                    break;
                default:
                    throw IDT.ThrowHelperError(new NotSupportedException(SR.GetString(SR.ClientUnsupportedCryptoAlgorithm, algorithmUri)));
            }

            return transform;
        }