16
Views
5
Comments
Solved
[AWS CloudFront Signer] Error "Invalid RSA Private Key" using this component.
Question
aws-cloudfront-signer
Service icon
Forge asset by Stefan Weber
Application Type
Service

Hi,

We are trying to use this component to avoid having the presigned URL data available to users.

However, despite following all the steps indicated in the article https://itnext.io/serve-files-at-scale-with-outsystems-and-aws-s3-and-cloudfront-6f0b11a37866, we are getting the error “Invalid RSA Private Key”

We create the private key with this command: 

openssl genpkey -algorithm RSA -out private_key.pem -pkeyopt rsa_keygen_bits:4096

Can anyone help?

2023-05-08 08-55-49
Luis Oliveira
Solution

Hi Stefan,

I understood the problem, it was related to the format of the private key we were generating.

We were generating a set of keys with the format PKCS#8 instead of PKCS#1.

We converted the key with this command and the private key that resulted from the conversion worked without any problems:

openssl pkcs8 -topk8 -inform PEM -outform PEM -nocrypt \

-in pkcs8-key.pem \

-out rsa-key.pem

Thank you for your help.

2021-10-09 07-57-44
Stefan Weber
 
MVP

Glad you figured it out. 

2021-10-09 07-57-44
Stefan Weber
 
MVP

Hi,

Sorry for the late reply. I switched employer in April and still very occupied by onboarding tasks and meet and greets.

At the moment CloudFront supports 2048 bits only. For details please see the documentation here https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-trusted-signers.html#private-content-creating-cloudfront-key-pairs

Best

Stefan

2023-05-08 08-55-49
Luis Oliveira

Hi Stefan,

We tested it with a 2048 key and it didn't work either, it returns the same error.

We've tried using the key in .pem and .xml format, but it always returns the same error.

Can you demo this component?

Regards,

2021-10-09 07-57-44
Stefan Weber
 
MVP

A demo component at least is on Forge https://www.outsystems.com/forge/component-overview/14291/serve-files-at-scale-demo-application-o11.
But I you mean a webinar right? Let me check if I can set something up and the near future. Actually a good idea... It has been a while since my last webinar :-)

2023-05-08 08-55-49
Luis Oliveira
Solution

Hi Stefan,

I understood the problem, it was related to the format of the private key we were generating.

We were generating a set of keys with the format PKCS#8 instead of PKCS#1.

We converted the key with this command and the private key that resulted from the conversion worked without any problems:

openssl pkcs8 -topk8 -inform PEM -outform PEM -nocrypt \

-in pkcs8-key.pem \

-out rsa-key.pem

Thank you for your help.

2021-10-09 07-57-44
Stefan Weber
 
MVP

Glad you figured it out. 

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.