How to encrypt public key (X509 RSA 2048) in Node.js?

An example of the value of the CardData form element:

PAN=4300000000000777;ExpDate=0519;CardHolder=IVAN PETROV;CVV=111

The CardData object is collected as a “key=value” list (separated by “;”), encrypted
public key (X509 RSA 2048), the resulting binary value is encoded in Base64.

my code

const key = new NodeRSA();
key.importKey(this._publicKey, 'pkcs8-public');
const encrypted = key.encrypt(cardData, 'base64');

this._publicKey – Open code (X509 RSA 2048), for encryption, issued by a bank

Card data blocking error.