Problem using Java Cryptography Architecture (JCA) Tools

Certified Senior Developer

Hi, 

I need to encrypt text with an asymmetric algorithm. 

I hope to use "Java Cryptography Architecture (JCA) Tools" because it exposes many algorithms to use, and I want to use RSA/ECB/PKCS1Padding. 

I don't see any method to generate Public/private key and every key I passed to keyencrypt I obtain an error:  

"Expression evaluation error at function 'keyencrypt' [line 5]: An error occurred: java.security.InvalidKeyException: unknown key type passed to RSA" 

This is "my code" (the key it's a generated public key): 

keyencrypt(
cleartext :"cleartext",
key: text2hex("MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA4IJZLsjlx+o4RSvafaAcReoNnzrI0UXu7kZyXPe31ql32X9AvhC6QQIUmLkr1Evm0zP/SgVG9YX3DSqBUgPo04iv1I1/wNKwAf1/uH9EiiqdpczefyxxnzJiKUTcx2/4mA4E4QxCIL5JsZb78WoYZrd2kToW/WD01MnSFiCgSyjGdd812GY2EVzfvlv8kYuti3icMUyitEfHhtw8cAWI6/nVrRPNs0e5NsvtZJ0nfrXsfQDR0C7+ivQK+fQabi8oRGsbTZceAvVlqVE669zoIwIFLcB+eYXTxbka4E7veUMpaF9w//HdwVS2y/2jJiI+16qPStQQPIKQ4Cucoif7/UHfIBuVGVJ5MIVyK7NC7TV/lyoXmyo7ZcnVZnI7rZcw5/qZcqaZ0VCrzvHijwTK7100hOOjiarvRa2OJGXHLIeAUlbrHOXEXS6ah2glPhLDEg6Qzp/lKVSISolal7q73qyhF483P9jXn3hefSLA9J1/1LgeajWvuVkxuw+dy2Tlv7oUpNBkX47/TOho5qttr1y9K3hD5Q87RAJPdBtFdDbY8qUPxoiBsTbUWjVoEjJf2YAsLTJIIi2ZISkbD/VdrtZnS73QSJkJReOMNT9XYNGDJvwNIrRcNGFKlJcX6qq+ozGNsDkrt0ObxAD7YCTjAYQVTlbQOaTu5DbGxGDNCoMCAwEAAQ=="),
transformation: "RSA/ECB/PKCS1Padding",
)

  Discussion posts and replies are publicly visible