Home Forums ActiveX components Xceed Encryption for ActiveX VC++.NET – passing a string to the Encrypt function….

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #42896 |

    Fairly new to .Net and converting VC++ 6.0 source. I am having a whale of a time trying to figure out how to past a string to the Encrypt function. Here what I am doing: (this is the example in the help doc’s)

    I get the error trying to past the “source” string, but it need to have a __gc*. Can anyone help?

    ===================================================
    Encryption = new XceedEncryptionClass();
    Encryption->License(MYLICENSE);

    Rijndael = new XceedRijndaelEncryptionMethodClass();
    String* source = S”This is the data to encrypt”;
    String* encryptedData;

    try
    {
    Rijndael->SetSecretKeyFromPassPhrase(S”This is a weak pass phrase”, 128 );
    Encryption->EncryptionMethod = Rijndael;

    encryptedData = Encryption->Encrypt(source, true );
    }
    catch( System::Runtime::InteropServices::COMException* except )
    {
    MessageBox::Show( except->ToString() );
    }
    ===================================================

    ..and I get this error message:

    error C2664:
    ‘System::Object __gc *Interop::XceedEncryptionLib::XceedEncryptionClass::Encrypt(System::Object __gc *__gc * ,bool)’ : cannot convert parameter 1 from ‘System::String __gc *’ to ‘System::Object __gc *__gc * ‘
    Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast

    Imported from legacy forums. Posted by Developer (had 3591 views)

    User (Old forums)
    Member
    Post count: 23064

    I found the solution. I needed the “&” sign. I don’t now what I did to get the compiler error when I used the “&” before, but it works now.

    Imported from legacy forums. Posted by Developer (had 3415 views)

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.