LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

CVI encryption support

Add samples/dotnet/mscorlib.fp to your project, and #include "mscorlib.h" in your source file. This is the shipping CVI generated wrapper for the .NET core runtime engine (mscorlib) assembly, which contains all the above objects.
0 Kudos
Message 11 of 19
(2,410 Views)

Jippi!!!

That actually works!! Thanks a lot!!

Smiley Very Happy

0 Kudos
Message 12 of 19
(2,404 Views)

May I know how to decrypt a encrypted file, which using DES algorithm?

Here are my coding, got error when create the DES service provider.

 

    System_IO_MemoryStream__Create_2 (&ms, (unsigned char *)input, 15920, NULL);
   
    System_IO_MemoryStream_WriteTo (ms, stream, NULL);
   
    err = System_Security_Cryptography_DESCryptoServiceProvider__Create(&des, NULL);
    err = System_Security_Cryptography_DESCryptoServiceProvider_Set_Key(des, key, 13, NULL);
    err = System_Security_Cryptography_DESCryptoServiceProvider_CreateDecryptor_1(des, &transform, NULL);
   
    err = System_Security_Cryptography_CryptoStream__Create(&cs, stream, transform, 0x0, NULL);
     
    System_Security_Cryptography_CryptoStream_Read (cs, &output, &x, 0, 15920, &outputLen, NULL);

0 Kudos
Message 13 of 19
(2,057 Views)

Hi moonlotus,

 

Did this produce a specific error code and/or message along with it?  Having that could be helpful in resolving the issue.  Also, just to clarify, are these functions that you have written yourself, or are they from a library?  Thanks!

Taylor G.
Product Support Engineer
National Instruments
www.ni.com/support
0 Kudos
Message 14 of 19
(2,020 Views)

These functions are from .NET library, I import "mscorlib.h".

 

I get error = -6571, which refers to

 

CDotNetInvocationTargetError

The target invoked by the LabWindows/CVI .NET Library threw an exception.

(source:http://zone.ni.com/reference/en-XX/help/370051H-01/cvi/cvidotnet_library_error/)

 

I can't find other example which is availabe in CVI, thus refering the coding from MSDN, DESCryptoServiceProvider

http://msdn.microsoft.com/en-us/library/system.security.cryptography.descryptoserviceprovider%28v=vs...

0 Kudos
Message 15 of 19
(2,016 Views)

Hi moonlotus,

 

Is this error definitely coming from the create step in your code, or is this the final value of "err" after execution?  One thing you could try, if you look at the function panel for the System_Security_Cryptography_DESCryptoServiceProvider__Create() function, if you declare an Exception Handle, rather than using NULL, you can get more information from the exception that is thrown by using the CDotNetGetExceptionInfo() function.  If you right-click on the Exception Handle in the function panel, you can see more information about to do this.  Hope this helps!

Taylor G.
Product Support Engineer
National Instruments
www.ni.com/support
0 Kudos
Message 16 of 19
(1,976 Views)

Thanks for your reply.

May I know where can I find the Crypt32.Lib? I'm using CVI 9.0.

0 Kudos
Message 17 of 19
(1,929 Views)

It should be found in c:\program files\National Instruments\CVIxx\sdk\lib folder; I don't know if this library is included in every CVI distribution.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 18 of 19
(1,919 Views)

I'm using CVI 9.0, but I do not have this file.

I got it after installing Microsoft Platform SDK.

Thanks.

0 Kudos
Message 19 of 19
(1,899 Views)