Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some *privateKeyPem outputs contain hashes, not PEM data #202

Open
nhinds opened this issue Feb 24, 2020 · 1 comment
Open

Some *privateKeyPem outputs contain hashes, not PEM data #202

nhinds opened this issue Feb 24, 2020 · 1 comment
Labels
area/docs Improvements or additions to documentation kind/bug Some behavior is incorrect or out of spec

Comments

@nhinds
Copy link

nhinds commented Feb 24, 2020

The SelfSignedCert.privateKeyPem and CertRequest.privateKeyPem outputs are both documented as:

PEM-encoded private key that the certificate will belong to

Similarly, the LocallySignedCert.caPrivateKeyPem output is documented as:

PEM-encoded private key data for the CA.

However, all 3 of these outputs really contain some kind of hash of the private key input, rather than the private key itself. This is consistent with the upstream Terraform documentation for e.g. tls_self_signed_cert:

Only an irreversable secure hash of the private key will be stored in the Terraform state.

I understand that the Pulumi docs are generated from the Terraform docs, but is there any way to override the documentation for these 3 fields to explain that the fields really contain a hash of the private key? Or to rename the fields privateKeyHash / caPrivateKeyHash, since they don't contain any PEM data?

Reproduction:

import * as pulumi from "@pulumi/pulumi";
import * as tls from "@pulumi/tls";

const key = new tls.PrivateKey("key", { algorithm: "ECDSA" });
const selfSignedCert = new tls.SelfSignedCert("crt", {
  isCaCertificate: true,
  subjects: [ { commonName: "crt", }, ],
  keyAlgorithm: "ECDSA",
  allowedUses: [ "cert_signing", "crl_signing", ],
  privateKeyPem: key.privateKeyPem,
  validityPeriodHours: 365 * 24,
});
export const keyPrivateKeyPem = key.privateKeyPem;
export const selfSignedCertPrivateKeyPem = selfSignedCert.privateKeyPem;

const key2 = new tls.PrivateKey("key2", { algorithm: "ECDSA" });
const certRequest = new tls.CertRequest("certRequest", {
  keyAlgorithm: "ECDSA",
  privateKeyPem: key2.privateKeyPem,
  subjects: [ { commonName: "locally-signed", }, ],
});
const locallySignedCert = new tls.LocallySignedCert("crt", {
  certRequestPem: certRequest.certRequestPem,
  caCertPem: selfSignedCert.certPem,
  caPrivateKeyPem: key.privateKeyPem,
  caKeyAlgorithm: "ECDSA",
  allowedUses: [ "cert_signing", "crl_signing", ],
  validityPeriodHours: 365 * 24,
});
export const key2PrivateKeyPem = key2.privateKeyPem;
export const certRequestPrivateKeyPem = certRequest.privateKeyPem;
export const locallySignedCertCaPrivateKeyPem = locallySignedCert.caPrivateKeyPem;

After pulumi up, the outputs show that while the 2 PrivateKey.privateKeyPem outputs return a PEM-encoded certificate, the other 3 return hashes:

Outputs:
    certRequestPrivateKeyPem        : "ba4b0e4e58590c12c7fa53f0fd6e085c6229e8fa"
    key2PrivateKeyPem               : "-----BEGIN EC PRIVATE KEY-----\nMGgCAQEEHMe6jwbDrXN+jQVaqAtBtHFRRclv3oFC3tNAW5CgBwYFK4EEACGhPAM6\nAAQLPMFTzVj0eTL6sUywk9mw9qYjpwhadUCd/j8armzU6N2VooZVbwlxAhcEXPPs\nHVmyQpmKKfR23Q==\n-----END EC PRIVATE KEY-----\n"
    keyPrivateKeyPem                : "-----BEGIN EC PRIVATE KEY-----\nMGgCAQEEHNl5/fpQ9Xd4XNfuhUx2yt4KSG+G1jlpovXgJIOgBwYFK4EEACGhPAM6\nAAR8n8CchzPI4f0zmlBi2TetfrkAofDiWkJ/GKa1FWFiMNH5W2bnmKW3mEiWq5Et\n8ueSgNzLsXDqYw==\n-----END EC PRIVATE KEY-----\n"
    locallySignedCertCaPrivateKeyPem: "61b5f689025d58c0aa9d5fecc8ab5154f54ecfbc"
    selfSignedCertPrivateKeyPem     : "61b5f689025d58c0aa9d5fecc8ab5154f54ecfbc"
@leezen leezen transferred this issue from pulumi/pulumi-tls Feb 25, 2020
@leezen leezen added the area/docs Improvements or additions to documentation label Feb 27, 2020
@susanev susanev added the kind/bug Some behavior is incorrect or out of spec label Apr 2, 2022
@susanev susanev transferred this issue from pulumi/docs Apr 26, 2023
@susanev susanev added the needs-triage Needs attention from the triage team label Apr 26, 2023
@iwahbe
Copy link
Member

iwahbe commented Apr 26, 2023

@susanev Thanks for moving this issue over to pulumi-tls (and bringing it to our attention). We can't do anything about it right now, but this is an excellent test case for our "user edited docs" work stream.

@iwahbe iwahbe removed the needs-triage Needs attention from the triage team label Apr 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/docs Improvements or additions to documentation kind/bug Some behavior is incorrect or out of spec
Projects
None yet
Development

No branches or pull requests

4 participants