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

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

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

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