UNPKG

@microsoft/dev-tunnels-ssh-keys

Version:

SSH key import/export library for Dev Tunnels

43 lines 1.92 kB
/// <reference types="node" /> import { KeyPair, DerReader, DerWriter, Random } from '@microsoft/dev-tunnels-ssh'; import { KeyFormatter } from './keyFormatter'; import { KeyData } from './keyData'; declare namespace Pkcs8KeyFormatter { interface Importer { (keyBytes: Buffer, oidReader: DerReader, includePrivate: boolean): Promise<KeyPair>; } interface Exporter { (keyPair: KeyPair, oidWriter: DerWriter, includePrivate: boolean): Promise<Buffer>; } } /** Provides import/export of the PKCS#8 key format. */ export declare class Pkcs8KeyFormatter implements KeyFormatter { private static readonly publicKeyType; private static readonly privateKeyType; private static readonly encryptedPrivateKeyType; constructor(); /** Mapping from public key algorithm OID to import handler for that algorithm. */ readonly importers: Map<string, Pkcs8KeyFormatter.Importer>; /** Mapping from public key algorithm name to export handler for that algorithm. */ readonly exporters: Map<string, Pkcs8KeyFormatter.Exporter>; /** Enables overriding randomness for predictable testing. */ random: Random; import(keyData: KeyData): Promise<KeyPair | null>; export(keyPair: KeyPair, includePrivate: boolean): Promise<KeyData>; decrypt(keyData: KeyData, passphrase: string | null): Promise<KeyData | null>; encrypt(keyData: KeyData, passphrase: string): Promise<KeyData>; private importPublic; private importPrivate; private static importRsaKey; private static importECKey; private exportPublic; private exportPrivate; private static exportRsaKey; private static exportECKey; private static decryptPrivate; private static encryptPrivate; private static getKeyEncryptionAlgorithm; private static pbkdf2; } export {}; //# sourceMappingURL=pkcs8KeyFormatter.d.ts.map