Exemplo n.º 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);
     }
 }
Exemplo n.º 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);
        }
Exemplo n.º 3
0
 public SecurityCore(SecurityKeyPair key)
 {
     _key = key;
 }