Exemple #1
0
        private static byte[] RemoveIso10126Padding(byte[] paddedBytes)
        {
            int paddingByteCount = GetPaddingByteCount(paddedBytes);

            // Can't verify randomness :)
            return(ByteUtilities.Truncate(paddedBytes, paddedBytes.Length - paddingByteCount));
        }
Exemple #2
0
        private static byte[] RemovePadding(byte[] buffer, int paddingByteCount, byte expectedPaddingByte)
        {
            for (int i = buffer.Length - paddingByteCount; i < (buffer.Length - 1); i++)
            {
                if (buffer[i] != expectedPaddingByte)
                {
                    throw InvalidPadding;
                }
            }

            return(ByteUtilities.Truncate(buffer, buffer.Length - paddingByteCount));
        }