예제 #1
0
 private static void ClearRsaParameters(RSAParameters parameters)
 {
     ByteArrayUtilities.Clear(parameters.Modulus);
     ByteArrayUtilities.Clear(parameters.Exponent);
     ByteArrayUtilities.Clear(parameters.D);
     ByteArrayUtilities.Clear(parameters.DP);
     ByteArrayUtilities.Clear(parameters.DQ);
     ByteArrayUtilities.Clear(parameters.InverseQ);
     ByteArrayUtilities.Clear(parameters.P);
     ByteArrayUtilities.Clear(parameters.Q);
 }
예제 #2
0
        private static bool isValuePresent(byte[] array, int offset, int length, params int[] values)
        {
            int num = (int)ByteArrayUtilities.ToUInt32(array, offset, length);

            foreach (int num2 in values)
            {
                if (num2 == num)
                {
                    return(true);
                }
            }
            return(false);
        }
예제 #3
0
        private static RSAParameters CreateRsaParameters(RsaKeyBlob keyBlob)
        {
            RSAParameters result = default(RSAParameters);

            result.Modulus  = ByteArrayUtilities.CreateReversedArray(keyBlob.Modulus);
            result.Exponent = ByteArrayUtilities.CreateReversedArray(keyBlob.Exponent);
            if (keyBlob.IsPrivateKey)
            {
                result.D        = ByteArrayUtilities.CreateReversedArray(keyBlob.D);
                result.DP       = ByteArrayUtilities.CreateReversedArray(keyBlob.DP);
                result.DQ       = ByteArrayUtilities.CreateReversedArray(keyBlob.DQ);
                result.InverseQ = ByteArrayUtilities.CreateReversedArray(keyBlob.InverseQ);
                result.P        = ByteArrayUtilities.CreateReversedArray(keyBlob.P);
                result.Q        = ByteArrayUtilities.CreateReversedArray(keyBlob.Q);
            }
            return(result);
        }
예제 #4
0
 public static uint ToUInt32(byte[] array)
 {
     return(ByteArrayUtilities.ToUInt32(array, 0, array.Length));
 }