Get a public key from a PEM-encoded private key.
Use this data source to get the public key from a PEM (RFC 1421) or OpenSSH PEM (RFC 4716) formatted private key, for use in other resources.
// DO NOT EDIT. Code generated by 'cdktf convert' - Please report bugs at https://cdk.tf/bug
import { Construct } from "constructs";
import { Fn, Token, TerraformStack } from "cdktf";
/*
* Provider bindings are generated by running `cdktf get`.
* See https://cdk.tf/provider-generation for more details.
*/
import { DataTlsPublicKey } from "./.gen/providers/tls/data-tls-public-key";
import { PrivateKey } from "./.gen/providers/tls/private-key";
class MyConvertedCode extends TerraformStack {
constructor(scope: Construct, name: string) {
super(scope, name);
const ed25519Example = new PrivateKey(this, "ed25519-example", {
algorithm: "ED25519",
});
new DataTlsPublicKey(this, "private_key_openssh-example", {
privateKeyOpenssh: Token.asString(Fn.file("~/.ssh/id_rsa_rfc4716")),
});
new DataTlsPublicKey(this, "private_key_pem-example", {
privateKeyPem: ed25519Example.privateKeyPem,
});
}
}
privateKeyOpenssh
(String, Sensitive) The private key (in OpenSSH PEM (RFC 4716) format) to extract the public key from. This is _mutually exclusive_ with private_key_pem
. Currently-supported algorithms for keys are: RSA
, ECDSA
, ED25519
.privateKeyPem
(String, Sensitive) The private key (in PEM (RFC 1421) format) to extract the public key from. This is _mutually exclusive_ with private_key_openssh
. Currently-supported algorithms for keys are: RSA
, ECDSA
, ED25519
.algorithm
(String) The name of the algorithm used by the given private key. Possible values are: RSA
, ECDSA
, ED25519
.id
(String) Unique identifier for this data source: hexadecimal representation of the SHA1 checksum of the data source.publicKeyFingerprintMd5
(String) The fingerprint of the public key data in OpenSSH MD5 hash format, e.g. aa:bb:cc:...
. Only available if the selected private key format is compatible, as per the rules for public_key_openssh
and ECDSA P224 limitations.publicKeyFingerprintSha256
(String) The fingerprint of the public key data in OpenSSH SHA256 hash format, e.g. SHA256:...
. Only available if the selected private key format is compatible, as per the rules for public_key_openssh
and ECDSA P224 limitations.publicKeyOpenssh
(String) The public key, in OpenSSH PEM (RFC 4716) format. This is also known as 'Authorized Keys' format. This is not populated for ECDSA
with curve P224
, as it is not supported. NOTE: the underlying libraries that generate this value append a \n
at the end of the PEM. In case this disrupts your use case, we recommend using trimspace()
.publicKeyPem
(String) The public key, in PEM (RFC 1421) format. NOTE: the underlying libraries that generate this value append a \n
at the end of the PEM. In case this disrupts your use case, we recommend using trimspace()
.