/// <summary> /// Export RSA public key /// </summary> /// <param name="rsa"></param> /// <returns></returns> /// <exception cref="ArgumentNullException"></exception> public static byte[] ExportRSAPublicKey(this RSA rsa) { if (rsa is null) { throw new ArgumentNullException(nameof(rsa)); } return(Convert.FromBase64String(rsa.GetPublicKeyInPkcs1())); }