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

            RandomNumberGenerator.GetNonZeroBytes(secureBytes.Buffer);
            return(secureBytes);
        }
Ejemplo 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);
        }
Ejemplo n.º 3
0
		internal SecureBuffer GetSecureRandomBytes (int size)
		{
			var secureBytes = new SecureBuffer (size);
			RandomNumberGenerator.GetNonZeroBytes (secureBytes.Buffer);
			return secureBytes;
		}
Ejemplo n.º 4
0
 public static void WriteLine(string message, SecureBuffer buffer)
 {
     DebugHelper.WriteBuffer(message, buffer);
 }
Ejemplo n.º 5
0
		public static void WriteLine (string message, SecureBuffer buffer)
		{
			DebugHelper.WriteBuffer (message, buffer);
		}
Ejemplo 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);
 }
Ejemplo 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;
		}
Ejemplo n.º 8
0
			protected override void CreateExplicitNonce (SecureBuffer explicitNonce)
			{
				Buffer.BlockCopy (parameters.ExplicitNonce, 0, explicitNonce.Buffer, 0, parameters.ExplicitNonce.Length);
			}