How to use aws-encryption-sdk.dll (C language) in C#?

using System.Runtime.InteropServices;
public class Program
   [DllImport(@"C:\Users\Abc\Documents\visual studio 2015\Projects\ConsoleApplication4\ConsoleApplication4\aws-encryption-sdk.dll", EntryPoint = "aws_cryptosdk_keyring_on_decrypt", CallingConvention = CallingConvention.StdCall)]
        public static extern void aws_cryptosdk_keyring_on_decrypt(ref IntPtr value);
        static void Main(string[] args)
            int value = 6;
            IntPtr sptr = Marshal.StringToHGlobalAnsi((value).ToString());
            aws_cryptosdk_keyring_on_decrypt(ref sptr);

I have tried with the above code. But getting error badimageformat exception. After changing cpu format 64 to 32 bit also i am getting the below error.

An unhandled exception of type 'System.BadImageFormatException' occurred in ConsoleApplication4.exe Additional information: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)

asked on Stack Overflow Oct 24, 2019 by Jagannath Kisan • edited Oct 24, 2019 by Jagannath Kisan

0 Answers

Nobody has answered this question yet.

User contributions licensed under CC BY-SA 3.0