Esempio n. 1
0
        internal SecureBuffer GetSecureRandomBytes(int size)
        {
            var secureBytes = new SecureBuffer(size);

            RandomNumberGenerator.GetNonZeroBytes(secureBytes.Buffer);
            return(secureBytes);
        }
Esempio n. 2
0
        internal static bool Compare(SecureBuffer buffer1, SecureBuffer buffer2)
        {
            if (buffer1 == null || buffer2 == null)
            {
                return(false);
            }

            if (buffer1.Size != buffer2.Size)
            {
                return(false);
            }

            for (int i = 0; i < buffer1.Size; i++)
            {
                if (buffer1.Buffer [i] != buffer2.Buffer [i])
                {
                    return(false);
                }
            }
            return(true);
        }
Esempio n. 3
0
		internal SecureBuffer GetSecureRandomBytes (int size)
		{
			var secureBytes = new SecureBuffer (size);
			RandomNumberGenerator.GetNonZeroBytes (secureBytes.Buffer);
			return secureBytes;
		}
Esempio n. 4
0
 public static void WriteLine(string message, SecureBuffer buffer)
 {
     DebugHelper.WriteBuffer(message, buffer);
 }
Esempio n. 5
0
		public static void WriteLine (string message, SecureBuffer buffer)
		{
			DebugHelper.WriteBuffer (message, buffer);
		}
Esempio n. 6
0
 public static void WriteLine(string message, SecureBuffer buffer)
 {
     Initialize();
     DebugHelper.WriteLine(String.Format("{0} ({1} bytes)", message, buffer.Size));
     DebugHelper.WriteBuffer(buffer.Buffer);
 }
Esempio n. 7
0
		internal static bool Compare (SecureBuffer buffer1, SecureBuffer buffer2)
		{
			if (buffer1 == null || buffer2 == null)
				return false;

			if (buffer1.Size != buffer2.Size)
				return false;

			for (int i = 0; i < buffer1.Size; i++) {
				if (buffer1.Buffer [i] != buffer2.Buffer [i])
					return false;
			}
			return true;
		}
Esempio n. 8
0
			protected override void CreateExplicitNonce (SecureBuffer explicitNonce)
			{
				Buffer.BlockCopy (parameters.ExplicitNonce, 0, explicitNonce.Buffer, 0, parameters.ExplicitNonce.Length);
			}