public byte[] EncryptWithPublic(CryptoRequest cryptoRequest) { var bytes64 = cryptoRequest.Data64; var publicKey = cryptoRequest.Password; byte[] bytes = Convert.FromBase64String(bytes64); Chilkat.Rsa rsaEncryptor = new Chilkat.Rsa { EncodingMode = "hex" }; rsaEncryptor.ImportPublicKey(publicKey); return(rsaEncryptor.EncryptBytes(bytes, usePrivateKey: false)); }