Пример #1
0
 public static bool TestKeyPair(SecurityKeyPair pair)
 {
     if (pair == null)
     {
         return(false);
     }
     try
     {
         RSACryptoServiceProvider rsa = new RSACryptoServiceProvider();
         string privateKeyNet         = pair.RSAPrivateKeyJava.RSAPrivateKeyJava2DotNet();
         rsa.FromXmlString(privateKeyNet);
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
Пример #2
0
        public static SecurityKeyPair GetSecurityKeyPair()
        {
            int             count = 3;
            bool            ckeck = false;
            SecurityKeyPair pair  = null;

            while (count > 0)
            {
                pair  = Generate();
                ckeck = TestKeyPair(pair);
                if (ckeck)
                {
                    break;
                }
                count--;
            }
            return(pair);
        }
Пример #3
0
 public SecurityCore(SecurityKeyPair key)
 {
     _key = key;
 }