/// <summary> /// Initialize the RSA class from a PEM string. /// </summary> /// <param name="keyInfo">PEM string</param> /// <param name="pw">password</param> public static RSAx CreateFromPEM(string keyInfo, string pw = "") { var key = OpenSSLKey.OpenSSLKey.PEMKeyToXKMSKey(keyInfo, pw); if (key.KeyPrivate != null) { return(new RSAx(RSAxUtils.GetRSAxParameters(key.KeyPrivate, key.KeySize), true)); } else { return(new RSAx(RSAxUtils.GetRSAxParameters(key.KeyPublic, key.KeySize), true)); } }
/// <summary> /// Initialize the RSA class from a XML KeyInfo string. /// </summary> /// <param name="keyInfo">XML Containing Key Information</param> /// <param name="modulusSize">Length of RSA Modulus in bits.</param> public static RSAx CreateFromXML(string keyInfo, int modulusSize) { return(new RSAx(RSAxUtils.GetRSAxParameters(keyInfo, modulusSize), true)); }