2017-05-09 4 views
2

でMissingMethodExceptionを投げ、私は窓からのコンソールアプリケーションの下に実行すると、私がしようとしたとき、それはAWSラムダ(Linuxカーネルバージョン - 4.4.51-40.60.amzn1.x86_64)Interop.Crypto.Pkcs12Parse

using System.Security.Cryptography.X509Certificates;  
public static void Main(string[] args) 
{ 
    Console.WriteLine("File exists: " + File.Exists("key.p12")); 
    var certificate = new X509Certificate2("key.p12", "notasecret"); 
    Console.WriteLine("Success"); 
    Console.ReadLine(); 
} 

を動作しますが、 AWSラムダその投げエラー以下

.ctor: MissingMethodException 
at Interop.Crypto.Pkcs12Parse(SafePkcs12Handle p12, String pass, SafeEvpPKeyHandle& pkey, SafeX509Handle& cert, SafeX509StackHandle& ca) 
at Internal.Cryptography.Pal.OpenSslPkcs12Reader.Decrypt(String password) 
at Internal.Cryptography.Pal.PkcsFormatReader.TryReadPkcs12(OpenSslPkcs12Reader pfx, String password, Boolean single, ICertificatePal& readPal, List`1& readCerts) 
at Internal.Cryptography.Pal.PkcsFormatReader.TryReadPkcs12(SafeBioHandle bio, String password, Boolean single, ICertificatePal& readPal, List`1& readCerts) 
at Internal.Cryptography.Pal.CertificatePal.FromBio(SafeBioHandle bio, String password) 
at Internal.Cryptography.Pal.CertificatePal.FromFile(String fileName, String password, X509KeyStorageFlags keyStorageFlags) 
at System.Security.Cryptography.X509Certificates.X509Certificate..ctor(String fileName, String password, X509KeyStorageFlags keyStorageFlags) 
at System.Security.Cryptography.X509Certificates.X509Certificate2..ctor(String fileName, String password) 
at test_openssl_lambda.Functions.TriggerSync() in /tmp/src818283224/src/test-openssl-lambda/test_openssl_lambda/Function.cs:line 21 
at lambda_method(Closure , Stream , Stream , ContextInfo) 

は私project.jsonある

{ 
    "version": "1.0.0-*", 
    "buildOptions": { 
    "emitEntryPoint": false 
    }, 

    "dependencies": { 
    "Microsoft.NETCore.App": { 
     "type": "platform", 
     "version": "1.0.0" 
    }, 

    "Amazon.Lambda.Core": "1.0.0", 
    "Amazon.Lambda.APIGatewayEvents": "1.1.0", 
    "Amazon.Lambda.Serialization.Json": "1.1.0", 
    "Amazon.Lambda.Tools": { 
     "type": "build", 
     "version": "1.5.0" 
    }, 

    "System.Security.Cryptography.X509Certificates": "4.3.0" 
    }, 

    "tools": { 
    "Amazon.Lambda.Tools": "1.5.0" 
    }, 

    "frameworks": { 
    "netcoreapp1.0": { 
     "imports": "dnxcore50" 
    } 
    } 
} 

4.4 - AWSラムダ環境(LinuxカーネルのバージョンでDLLIMPORT System.Security.Cryptography.Native.OpenSslを行うことが、そのことはできませんので、とFunction.cs(コンソールアプリケーション上記と同じである)

using System.Security.Cryptography.X509Certificates; 
using Amazon.Lambda.Core; 

[LambdaSerializer(typeof(Amazon.Lambda.Serialization.Json.JsonSerializer))] 
public void Trigger() 
{ 
    Console.WriteLine("File exists: " + File.Exists("Key.p12")); 
    var certificate = new X509Certificate2("Key.p12", "notasecret"); 
    Console.WriteLine("Success"); 
} 

を呼び出すと、それが例外をスローします.51-40.60.amzn1.x86_64) 誰かが問題の解決に手伝ってくれますか?つまり、AWS LambdaにSystem.Security.Cryptography.Native.OpenSslをインストールする手助けをしていますか?

答えて

関連する問題