I have been tasked to create a C# interface with some of the methods that are being using in the Open Source CrytoLib C++ project. I am trying to create a managed wrapper for the LIB file… however I am getting some errors already and cannot figure out what I am doing wrong as this seems pretty straightforward to this point.
My header file:
// CryptoLibWrapper.h
#pragma once
using namespace System;
namespace CryptoLibWrapper {
public ref class DefaultDecryptorWithMAC
{
public:
BOOL Decrypt(BYTE const* pEncrypted, UINT uLength, BYTE** ppBuffer, DWORD* pdwLength);
};
}
The errors I am getting…
error C2061: syntax error : identifier ‘BYTE’
error C2146: syntax error : missing ‘;’ before identifier ‘Decrypt’
error C4430: missing type specifier – int assumed. Note: C++ does not support default-int
error C4430: missing type specifier – int assumed. Note: C++ does not support default-int
It has been a while since I have done any C++ and even that was limited, hoping this is easy and I am just being brain dead.
Thanks again!
EDIT: Note… all of the errors are at the "BOOL Decrypt…" line
Seems like you’re probably getting the first error because you’re missing some type definitions. The other errors are probably just as a result of those missing definitions.
You need to include a file that defines BYTE. Putting this at the top of your file should do the job:
or if you don’t care about pulling in the whole of the windows headers, you could try: