method KeyObject.prototype.export
Usage in Deno
```typescript import { KeyObject } from "node:node__crypto.d.ts"; ```
KeyObject.prototype.export(options: KeyExportOptions<"pem">): string | Buffer
For symmetric keys, the following encoding options can be used:
For public keys, the following encoding options can be used:
For private keys, the following encoding options can be used:
The result type depends on the selected encoding format, when PEM the
result is a string, when DER it will be a buffer containing the data
encoded as DER, when [JWK](https://tools.ietf.org/html/rfc7517) it will be an object.
When [JWK](https://tools.ietf.org/html/rfc7517) encoding format was selected, all other encoding options are
ignored.
PKCS#1, SEC1, and PKCS#8 type keys can be encrypted by using a combination of
the `cipher` and `format` options. The PKCS#8 `type` can be used with any`format` to encrypt any key algorithm (RSA, EC, or DH) by specifying a`cipher`. PKCS#1 and SEC1 can only be
encrypted by specifying a `cipher`when the PEM `format` is used. For maximum compatibility, use PKCS#8 for
encrypted private keys. Since PKCS#8 defines its own
encryption mechanism, PEM-level encryption is not supported when encrypting
a PKCS#8 key. See [RFC 5208](https://www.rfc-editor.org/rfc/rfc5208.txt) for PKCS#8 encryption and [RFC 1421](https://www.rfc-editor.org/rfc/rfc1421.txt) for
PKCS#1 and SEC1 encryption.
options: KeyExportOptions<"pem">
string | Buffer
KeyObject.prototype.export(options?: KeyExportOptions<"der">): Buffer
optional
options: KeyExportOptions<"der">
Buffer
KeyObject.prototype.export(options?: JwkKeyExportOptions): JsonWebKey
optional
options: JwkKeyExportOptions