amazon web services - openssl parse error c# aws lambda mqtt -


i trying create aws-lambda function in c# publishes aws-iot thing via mqtt.

for now, trying publish string message test topic subscribed to.

this code works when running via unit test , string received on iot thing.

when deploying aws code publishes without error when invoking code receive following response.

{ "errortype" : "opensslcryptographicexception", "errormessage" : "error:23076072:pkcs12 routines:pkcs12_parse:parse error", "stacktrace"   : [     "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 raspberrypi.function.sendmqttmessage(string stopic, string smessage)",     "at raspberrypi.function.functionhandler(skillrequest oskillrequest, ilambdacontext ocontext)",     "at lambda_method(closure , stream , stream , contextinfo )" ] } 

my code publish

public bool sendmqttmessage(string stopic, string smessage)     {         x509certificate2 clientcert = new x509certificate2(filename: "./certificates/be427151d2.pfx", password: "****", keystorageflags: x509keystorageflags.defaultkeyset);         x509certificate cacert = new x509certificate(filename: "./certificates/rootca.pem");          mqttclient client = new mqttclient("*****", 8883, true, cacert, clientcert, mqttsslprotocols.tlsv1_2); //m2mqtt          client.connect("clientid1");          client.publish(stopic, encoding.utf8.getbytes(smessage));          return client.isconnected;      } 


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -