Exemplo n.º 1
0
        private static ICryptoTransform CreateTransformCore(
            CipherMode cipherMode,
            PaddingMode paddingMode,
            byte[] key,
            byte[] iv,
            int blockSize,
            bool encrypting)
        {
            SafeAlgorithmHandle algorithm = TripleDesBCryptModes.GetSharedHandle(cipherMode);

            BasicSymmetricCipher cipher = new BasicSymmetricCipherBCrypt(algorithm, cipherMode, blockSize, key, false, iv, encrypting);

            return(UniversalCryptoTransform.Create(paddingMode, cipher, encrypting));
        }
Exemplo n.º 2
0
        private static ILiteSymmetricCipher CreateLiteCipher(
            CipherMode cipherMode,
            PaddingMode paddingMode,
            ReadOnlySpan <byte> key,
            ReadOnlySpan <byte> iv,
            int blockSize,
            int paddingSize,
            int feedbackSize,
            bool encrypting)
        {
            SafeAlgorithmHandle algorithm = TripleDesBCryptModes.GetSharedHandle(cipherMode, feedbackSize);

            return(new BasicSymmetricCipherLiteBCrypt(
                       algorithm,
                       cipherMode,
                       blockSize,
                       paddingSize,
                       key,
                       ownsParentHandle: false,
                       iv,
                       encrypting));
        }