. Js script file in c# console application

adicsharp

New member
Joined
May 5, 2024
Messages
4
Programming Experience
5-10
I have a requirement to decrypt data encrypted using jscrypto.

I have a .js file which has encrypt and decrypt functions. I want to use that file in c# code and use its decrypt function.

I am not able to decode the algorithm to replicate the decrypt function in .net code. Iv is generated through code in .js file

I know .js files can be used in asp.net but here as I need a DLL/exe to use so I need a console application.

Any thoughts of calling decrypt function from js file using c#?

Or can someone suggest best way to create a DLL/exe using .net by embedding js file.

Thanks.
 
Why not just install Node.JS on the machine and use the JavaScript from the console directly? Why do you need to call it from a C# based console program?
 
THanks for the suggestion. I wanted to execute the dll from SSIS.
we have huge .qvd files where data is encrypted using Jscrypto. I wanted to created a dll which can read the qvd text file, then decrypt the data and input to sql.

I have issues decoding the algorithm in c# using AES encrypt/decrypt and when decoding am getting junk values. So, decided to use the jscript decrypt from the script file used while encrypting which already had a decrypt function.

I thought c# would be easy if I can find out a way to decrypt.
 
Last edited:
A DLL is different from a console app. A DLL can be loaded into any kind of app. You started this thread asking about hosting in a console app.
 
If SSIS can invoke a .EXE, then it can run NodeJS.
 

Please recall that this is a C# forum, though, so take the above with a huge grain of salt. There maybe an easier way to run a JavaScript program on the console.
 
If finally got around to reading about "jscripto". It seems like it's just a library that simplifies access to common wellknown algorithms. For example its supported encryption ciphers are aes, des, des3, and rc4. It is not some custom encryption algorithm.

These are standard algorithms. They are language agnostic. So something encrypted using AES in JavaScript, should be decryptable by code written in C#. You shouldn't have to bend over backwards to host JavaScript in a .NET program just to decrypt something that was encrypted by jscripto.
 

Latest posts

Back
Top Bottom