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); } }
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); }
public SecurityCore(SecurityKeyPair key) { _key = key; }