Port RSA encryption Java code to C#
问题 I'm trying to port the following Java code to a C# equivalent: public static String encrypt(String value, String key) throws InvalidKeySpecException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException { byte[] bytes = value.getBytes(Charset.forName("UTF-8")); X509EncodedKeySpec x509 = new X509EncodedKeySpec(DatatypeConverter.parseBase64Binary(key)); KeyFactory factory = KeyFactory.getInstance("RSA"); PublicKey publicKey =