PKI --PUB(1) strongSwan PKI --PUB(1)

# [NAME](#NAME)

pki --pub - Extract a public key from a private key or certificate

# [SYNOPSIS](#SYNOPSIS)

`pki --pub` \[**--in** *file*|***--keyid*** *hex*] \[**--type** *type*] \[**--outform** *encoding*] \[**--debug** *level*]

`pki --pub` **--options file**

`pki --pub` **-h** | **--help**

# [DESCRIPTION](#DESCRIPTION)

This sub-command of [**pki**(1)](/man/enterprise-packages/strongswan/pki.1) extracts public keys from a private keys and certificates.

# [OPTIONS](#OPTIONS)

[**-h, --help**](#h,)

Print usage information with a summary of the available options.

[**-v, --debug level**](#v,)

Set debug level, default: 1.

**-+, --options file**

Read command line options from *file*.

[**-i, --in file**](#i,)

Input file. If not given the input is read from *STDIN*.

[**-x, --keyid hex**](#x,)

Smartcard or TPM private key object handle in hex format with an optional 0x prefix.

[**-t, --type type**](#t,)

Type of input. One of *priv* (private key), *rsa* (RSA private key), *ecdsa* (ECDSA private key), *pub* (public key), *pkcs10* (PKCS#10 certificate request), or *x509* (X.509 certificate), defaults to *priv*.

[**-f, --outform encoding**](#f,)

Encoding of the extracted public key. One of *der* (ASN.1 DER), *pem* (Base64 PEM), *dnskey* (RFC 3110 DNS key), or *sshkey* (RFC 4253 SSH key), defaults to *der*.

# [EXAMPLES](#EXAMPLES)

Extract the public key from an RSA private key:

```


  pki --pub --in key.der > pub.der
```

Extract the public key from an X.509 certificate:

```


  pki --pub --in cert.der --type x509 > pub.der
```

# [SEE ALSO](#SEE_ALSO)

[**pki**(1)](/man/enterprise-packages/strongswan/pki.1)

2013-07-31 6.1.0

---

Document: pki---pub(1) from strongswan 6.1.0-r6 (Chainguard OS)
Source: https://github.com/strongswan/strongswan
