AWS CloudFront 表示公钥无效/超出限制

Ian*_*art 6 public-key-encryption amazon-cloudfront ssh-keygen

我正在尝试在 AWS CloudFront 上上传公钥。我生成密钥如下

ssh-keygen -t ecdsa -b 521

我也尝试过

ssh-keygen -b 4096

当我通过控制台上传它时,出现以下错误: com.amazonaws.services.cloudfront.model.InvalidArgumentException:您的请求包含空/无效/超出限制的 RSA 编码密钥(服务:AmazonCloudFront;状态代码:400;错误代码:InvalidArgument;请求 ID:08fa98af-0c02-11ea-b06e-d771d01bbfcb)

结果ssh -V是“OpenSSH_7.7p1,OpenSSL 1.0.2p 14 Aug 2018”。

任何帮助,将不胜感激。谢谢。

Ian*_*art 12

我通过这样生成密钥解决了这个问题:

openssl genrsa -out key.pem

openssl rsa -pubout -in key.pem -out pubkey.pem

并上传生成的 pubkey.pem。我仍然不确定我之前的方法不起作用的具体原因。


Jam*_*ean 9

这是因为 CloudFront 不支持长度为 4096 位的密钥。当您运行命令时,openssl rsa -pubout -in key.pem -out pubkey.pem它默认生成它接受的 2048 位密钥。

The length of the public key for a certificate depends on where you're storing it.

Importing a certificate into AWS Certificate Manager (ACM): public key length must be 1024 or 2048 bits. The limit for a certificate that you use with CloudFront is 2048 bits, even though ACM supports larger keys.

Uploading a certificate to the AWS Identity and Access Management (IAM) certificate store: maximum size of the public key is 2048 bits.
Run Code Online (Sandbox Code Playgroud)

云前SSL