How to use AWS ACM Private with Docker Node.js + nginx proxy? - node.js

i'm trying to use the private CA generated on AWS ACM but i dont know what to do with Certificate.pem and CertificateChain.pem that is generated.
edit: See my answer below.

To whoever see this on future:
AWS ACM Private CA doesn't support exporting private key, since it only works inside aws ecosystem.
If you want to use a SSL certificate on another host, you need to use another provider.

For importing the private key, you need to generate one from your end first, create a csr & private key before you ask for ssl certificate to the provider. Once you have the private key, you can import all three (private key, certificate & certificate chain body) to AWS ACM.

Related

Cannot get Client Certificate to work in HTTP Action of Logic App

I am trying to add a HTTP Action that uses Client Certificate authentication to a logic App
When I specify the PFX file that I have generated, I get an error stating
The provided authentication certificate is missing the private key. The private key is required to sign the request.
I am using the portal directly not code
I do have the private key
How do I specify this?
Paul
The provided authentication certificate is missing the private key. The private key is required to sign the request.
You are receiving this error because it is missing a private key. You cannot use Client Certificates for authentication without a private key.
On the Client, the Client Certificates must have a Private Key. If absent, then the certificate is ignored. For more information on this, you can refer Here
While Client certificate Import/Export you need to check the box which will provide us the private key.
Alternate:
Sometimes .pfx gile will not work directly. Use OpenSSL to convert them to a .pem, then back to a pfx to get it to work:
openssl pkcs12 -in certificate.pfx -out certificate.pem
openssl pkcs12 -in certificate.pem -export -out certificate2.pfx
The pfx file will work within Azure logic apps when converted to a base64 string. When the pfx file is imported into the Certificates MMC try exporting again and it works.
REFERENCES:
Call service endpoints by using HTTP or HTTPS - Azure Logic Apps | Microsoft Docs
Vertifi - Digital Certificates
LogicApp: Certificate Authentication for HTTP GET Action not working · Issue #51400 · MicrosoftDocs/azure-docs (github.com)

How to get the certificate password from a self signed certificate

I want to aquire a token from an Azure app registration with a certificate.
I followed the instructions here and generated a self signed certificate with Powershell. I also imported the public key into the portal.
But if I want to access the app via .NET, I need to provide the following MSAL configuration:
The CertificateFileContents is just the public key I exported from the certgmgr. But what should I put as the CertificatePass? Is this a hash? Or a private key? I could not find anything in the docs and also the link above does not give me any advice...
Also I do not really understand why the private key is not imported to the portal?
In my experience, CertificatePass should be required when you export a private key.
This document has such content before:
Export the private key, specify a password for the cert file, and
export to a file.
But now it only tells you to export a public key. You can see details from this issue.
So based on the SharePoint document, if you are reading a PFX file from your local machine, I think you should use private key with a password.
Okay, the CertificatePass was the password for the certificate itself.
The Azure Portal itself only holds the public key.
The client application needs to provide the whole certificate with private and public key.
If you export a private/public key from certificate manager in Windows 10, you will not be able to directly export this as base64, but you can create a pfx file.
Those files can later be encoded to Base64 with a tool of your choice. For example this.
The password for your certificate has to be the CertificatePass, the FileContents are the Base64 public and private key, but decrypted with the password.
This is of course only an approach for testing purpose. In a production environment you would rather use key vault or something similar to not have any secrets in your appsettings.json.

How to encrypt and decrypt using ECDSA private key and public key generated in Hyperledger fabric

I am working on a basic-network project on Hyperledeger Fabric V-1.4.1. I have enrolled an admin and created a user using enrollAdmin.js and registerUser.js. A public Key and a private key is generated for user1. Now I want to use that private key to sign simple data and later verify using the public Key. I have tried using URSA node module which works fine with RSA keys generated through OpenSSL but isn't working with these two keys. Probably because these keys are not RSA, they are ECDSA keys. I have also read the documentation of the Crypto node module and it seems I need to have .pem files as keys to use in Crypto module. But In fabric, I have key files as -priv and -pub format.
Is there any node module that can encrypt decrypt using ECDSA keys?
Is there any specific way in hyperledger fabric to do this?
Or is there any other way I can do this thing? Please ask any questions if necessary.
Thank you.
The two formats you see
priv
pub
Are wallet formate of filestorage
Try to register an identity and enroll with fabric-CA by importing identity service then you will receive certificate and private key just put it in a file and mark the extension as pem and it will work

IIS: SSL certificate request and private key exportable

I'm writing to ask for this question: when a new wildcard SSL certificate request is made from IIS (wizard), does the "private key exportable" option enabled ? Because once installed, I need to export the new certificate together with private key.
Thank you,
Luca
If you need to export the key (to install the same cert in other server for example) you need to mark private Key as exportable. Otherwise that certificate wont work in any other machine (as the key will be different) I do not think its a best practise tho.
I found a more secure way:
Generate the CSR and private key file by using openssl
Submit the CSR to public CA
Convert the certificate issued by public CA from CRT to PFX (containing the private key - not marked as exportable)
Bye,
Luca

NodeJS: HTTPS Server error w/ host key (wrong tag?)

I am receiving an error when the https server starts, something along the lines of:
Error:0D0680A8:asn1 encoding routines:ASN1_CHECK_TLEN:wrong tag
I may be completely going about this the wrong way. I need to get an SSL cert from a 3rd party CA. This CA requires that I give them a Certificate Signing Request (CSR) that I have generated.
I generated a CSR using certreq.exe on Windows and provided the CSR to them. They provided the public key cert in response.
Here's where I'm a little confused. The https server has a key and cert property. As I understand, cert is for the public key (from the CA) and key is for the private key. Where's this private key??
After some googling, it appears that certreq.exe will create a key pair in the windows cert store when the CSR is generated. I exported the PFX, used openssl to extract the private key, and decrypted the key so that it was in a format that had "--BEGIN RSA PRIVATE KEY.. etc". The key looks fine to me. It's formatted the same way my previous self-signed certs were formatted which worked fine.
I used this private key for the https key property and received that asn1 wrong tag error. Am I going about getting the private key the wrong way? Or is the error something else?

Resources