Strange problem with IPC and CryptoJS

Hello,
i am using electron + angular to read text file and decrypt it.
when i use Electron - it is not decrypting. If i take the same value from the text file and put it in angular - it is working.

electron main:

const rawdata = fs.readFileSync(_APPHOME_ + 'license.json');
event.returnValue = rawdata;

angular:

this.textToConvert = window.electronIpcSendSync('getLicInfo', ''); - this is not ok.
// this.textToConvert = 'U2FsdGVkX19rloSft5UXSg4hPfX7jRovT3Xpc6R18......'; - this is OK
   this.conversionOutput = CryptoJS.AES.decrypt(
    this.textToConvert,
    this.encryptSecretKey.trim()
    ).toString(CryptoJS.enc.Utf8);

can you tell me what is the difference here.
thank you !

Have you checked what window.electronIpcSendSync('getLicInfo', '') returns?

Hello,
yes - same string as the one here:

// this.textToConvert = 'U2FsdGVkX19rloSft5UXSg4hPfX7jRovT3Xpc6R18......';

if i manually write it in the typescript, it is working…

Are you sure it has no trailing newline?

thank you for the hint !
i made some research and added :

encodedtext.**toString().replace(/ /g, '')**

now all is fine :slight_smile: