简体   繁体   中英

AWS Encryption SDK for .NET — Binding AWS-Encryption-SDK to C#

My current project is using the AWS-Encryption-SDK for Python and Node in respective solutions, but we also need a corresponding solution in .NET. However, AWS does not have that SDK in C# yet.

Does anyone out there have experience with binding the AWS-Encryption-SDK in C/C++ to .NET using PInvoke, Marshalling, and/or DllImport attribute usage?

Once you have generated DLL using C/C++ code, ensure the generated DLL is copied alongside other DLL's the project is dependent on.

Add the following code in your C# project which would invoke the Function present in DLL

using System.Runtime.InteropServices;
            
[DllImport("GeneratedDLLName.dll", EntryPoint = "FunctionName")]
public static extern string Foo(string payload);

public string InvokeSDKMethod(string payload)
{
  var response = Foo(payload);
  return response;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM