@microsoft/dev-tunnels-ssh
Version:
SSH library for Dev Tunnels
63 lines • 1.94 kB
TypeScript
/// <reference types="node" />
import { Buffer } from 'buffer';
import { BigInt } from './bigInt';
export declare const enum DerType {
Integer = 2,
BitString = 3,
OctetString = 4,
Null = 5,
ObjectIdentifier = 6,
Sequence = 16,
Set = 17,
Constructed = 32,
Tagged = 160
}
/**
* Reads data in DER (Distinguished Encoding Rules) format.
*
* Enables importing and exporting key files, which are commonly DER-encoded.
*/
export declare class DerReader {
private readonly buffer;
private position;
constructor(buffer: Buffer, dataType?: DerType);
get available(): number;
readNull(): void;
readInteger(): BigInt;
readOctetString(): Buffer;
readBitString(): Buffer;
readObjectIdentifier(expected?: string): string;
readSequence(): DerReader;
tryReadTagged(tagId: number): DerReader | null;
/** Reads the type of the next value in the sequence WITHOUT advancing the reader position. */
peek(): DerType;
private readLength;
private readByte;
private readBytes;
private readType;
}
/**
* Writes data in DER (Distinguished Encoding Rules) format.
*
* Enables importing and exporting key files, which are commonly DER-encoded.
*/
export declare class DerWriter {
private buffer;
private readonly dataType;
private static lengthBuffer;
private position;
constructor(buffer: Buffer, dataType?: DerType);
toBuffer(): Buffer;
writeSequence(data: DerWriter): void;
writeTagged(tagId: number, data: DerWriter): void;
writeNull(): void;
writeInteger(value: BigInt): void;
writeOctetString(data: Buffer): void;
writeBitString(data: Buffer): void;
writeObjectIdentifier(oid: string): void;
private static getLength;
private writeByte;
private writeBytes;
private ensureCapacity;
}
//# sourceMappingURL=derData.d.ts.map