@types/node-forge
- Version 1.3.2
- Published
- 60.3 kB
- 1 dependency
- MIT license
Install
npm i @types/node-forge
yarn add @types/node-forge
pnpm add @types/node-forge
Overview
TypeScript definitions for node-forge
Index
Namespaces
node-forge.pki
- Attribute
- BinaryFingerprintOptions
- ByteBufferFingerprintOptions
- CAStore
- Certificate
- CertificateField
- CertificateFieldOptions
- certificateFromAsn1()
- certificateFromPem()
- CertificateRequest
- certificateToAsn1()
- certificateToPem()
- certificationRequestFromAsn1()
- certificationRequestFromPem()
- certificationRequestToAsn1()
- certificationRequestToPem()
- createCaStore()
- createCertificate()
- createCertificationRequest()
- decryptPrivateKeyInfo()
- decryptRsaPrivateKey()
- encryptedPrivateKeyFromPem()
- encryptedPrivateKeyToPem()
- EncryptionOptions
- encryptPrivateKeyInfo()
- encryptRsaPrivateKey()
- GetAttributeOpts
- getPublicKeyFingerprint()
- HexFingerprintOptions
- KeyPair
- oids
- oids
- PEM
- pemToDer()
- PrivateKey
- privateKeyFromAsn1()
- privateKeyFromPem()
- privateKeyInfoToPem()
- privateKeyToAsn1()
- privateKeyToPem()
- PublicKey
- publicKeyFromAsn1()
- publicKeyFromPem()
- publicKeyToAsn1()
- publicKeyToPem()
- publicKeyToRSAPublicKey()
- publicKeyToRSAPublicKeyPem()
- setRsaPrivateKey
- setRsaPublicKey
- verifyCertificateChain()
- wrapRsaPrivateKey()
node-forge.tls
- Alert
- BulkCipherAlgorithm
- CertificateRequest
- CipherSuite
- CipherSuites
- CipherType
- CompressionMethod
- Connection
- ConnectionEnd
- ConnectionState
- ContentType
- createConnection()
- createSessionCache()
- HandshakeType
- HeartbeatMessageType
- hmac_sha1()
- MACAlgorithm
- MaxFragment
- prf_tls1()
- PRFAlgorithm
- ProtocolVersion
- Record
- Session
- SessionCache
- SupportedVersions
- TLSError
- Verified
- Version
- Versions
Namespaces
namespace node-forge
module 'node-forge' {}
variable md
const md: { sha1: { create(): md.sha1.MessageDigest }; sha256: { create(): md.sha256.MessageDigest }; sha512: { create<TAlg extends md.sha512.AlgorithmSelection = 'SHA-512'>( algorithm?: TAlg ): TAlg extends 'SHA-384' ? md.sha512.Sha384MessageDigest : TAlg extends 'SHA-512/224' ? md.sha512.Sha512224MessageDigest : TAlg extends 'SHA-512/256' ? md.sha512.Sha512256MessageDigest : TAlg extends 'SHA-512' ? md.sha512.Sha512MessageDigest : never; sha224: { create(): md.sha512.Sha512224MessageDigest }; sha256: { create(): md.sha512.Sha512256MessageDigest }; sha384: { create(): md.sha512.Sha384MessageDigest }; }; sha384: typeof md.sha512.sha384; 'sha512/224': typeof md.sha512.sha224; 'sha512/256': typeof md.sha512.sha256; md5: { create(): md.md5.MessageDigest }; algorithms: { md5: typeof md.md5; sha1: typeof md.sha1; sha256: typeof md.sha256; sha384: typeof md.sha384; sha512: typeof md.sha512; 'sha512/224': typeof md['sha512/224']; 'sha512/256': typeof md['sha512/256']; };};
variable md5
const md5: { create(): md.md5.MessageDigest };
variable sha1
const sha1: { create(): md.sha1.MessageDigest };
variable sha256
const sha256: { create(): md.sha256.MessageDigest };
variable sha384
const sha384: { create(): md.sha512.Sha384MessageDigest };
variable sha512
const sha512: { create<TAlg extends md.sha512.AlgorithmSelection = 'SHA-512'>( algorithm?: TAlg ): TAlg extends 'SHA-384' ? md.sha512.Sha384MessageDigest : TAlg extends 'SHA-512/224' ? md.sha512.Sha512224MessageDigest : TAlg extends 'SHA-512/256' ? md.sha512.Sha512256MessageDigest : TAlg extends 'SHA-512' ? md.sha512.Sha512MessageDigest : never; sha224: { create(): md.sha512.Sha512224MessageDigest }; sha256: { create(): md.sha512.Sha512256MessageDigest }; sha384: { create(): md.sha512.Sha384MessageDigest };};
type Base64
type Base64 = string;
type Byte
type Byte = number;
type Bytes
type Bytes = string;
type Encoding
type Encoding = 'raw' | 'utf8';
type Hex
type Hex = string;
type OID
type OID = string;
type Utf8
type Utf8 = string;
namespace node-forge.asn1
namespace node-forge.asn1 {}
function create
create: ( tagClass: Class, type: Type, constructed: boolean, value: Bytes | Asn1[]) => Asn1;
function derToOid
derToOid: (der: util.ByteStringBuffer) => OID;
function fromDer
fromDer: (bytes: Bytes | util.ByteBuffer, strict?: boolean) => Asn1;
function oidToDer
oidToDer: (oid: OID) => util.ByteStringBuffer;
function toDer
toDer: (obj: Asn1) => util.ByteBuffer;
interface Asn1
interface Asn1 {}
property composed
composed: boolean;
property constructed
constructed: boolean;
property tagClass
tagClass: Class;
property type
type: Type;
property value
value: Bytes | Asn1[];
enum Class
enum Class { UNIVERSAL = 0x00, APPLICATION = 0x40, CONTEXT_SPECIFIC = 0x80, PRIVATE = 0xc0,}
member APPLICATION
APPLICATION = 0x40
member CONTEXT_SPECIFIC
CONTEXT_SPECIFIC = 0x80
member PRIVATE
PRIVATE = 0xc0
member UNIVERSAL
UNIVERSAL = 0x00
enum Type
enum Type { NONE = 0, BOOLEAN = 1, INTEGER = 2, BITSTRING = 3, OCTETSTRING = 4, NULL = 5, OID = 6, ODESC = 7, EXTERNAL = 8, REAL = 9, ENUMERATED = 10, EMBEDDED = 11, UTF8 = 12, ROID = 13, SEQUENCE = 16, SET = 17, PRINTABLESTRING = 19, IA5STRING = 22, UTCTIME = 23, GENERALIZEDTIME = 24, BMPSTRING = 30,}
member BITSTRING
BITSTRING = 3
member BMPSTRING
BMPSTRING = 30
member BOOLEAN
BOOLEAN = 1
member EMBEDDED
EMBEDDED = 11
member ENUMERATED
ENUMERATED = 10
member EXTERNAL
EXTERNAL = 8
member GENERALIZEDTIME
GENERALIZEDTIME = 24
member IA5STRING
IA5STRING = 22
member INTEGER
INTEGER = 2
member NONE
NONE = 0
member NULL
NULL = 5
member OCTETSTRING
OCTETSTRING = 4
member ODESC
ODESC = 7
member OID
OID = 6
member PRINTABLESTRING
PRINTABLESTRING = 19
member REAL
REAL = 9
member ROID
ROID = 13
member SEQUENCE
SEQUENCE = 16
member SET
SET = 17
member UTCTIME
UTCTIME = 23
member UTF8
UTF8 = 12
namespace node-forge.cipher
namespace node-forge.cipher {}
function createCipher
createCipher: ( algorithm: Algorithm, payload: util.ByteBuffer | Bytes) => BlockCipher;
function createDecipher
createDecipher: ( algorithm: Algorithm, payload: util.ByteBuffer | Bytes) => BlockCipher;
interface BlockCipher
interface BlockCipher {}
interface StartOptions
interface StartOptions {}
property additionalData
additionalData?: string | undefined;
property iv
iv?: util.ByteBuffer | Byte[] | Bytes | undefined;
property tag
tag?: util.ByteStringBuffer | undefined;
property tagLength
tagLength?: number | undefined;
type Algorithm
type Algorithm = | 'AES-ECB' | 'AES-CBC' | 'AES-CFB' | 'AES-OFB' | 'AES-CTR' | 'AES-GCM' | '3DES-ECB' | '3DES-CBC' | 'DES-ECB' | 'DES-CBC';
namespace node-forge.hmac
namespace node-forge.hmac {}
namespace node-forge.jsbn
namespace node-forge.jsbn {}
class BigInteger
class BigInteger {}
constructor
constructor(a: null);
constructor
constructor(a: number, c: RandomGenerator);
constructor
constructor(a: number, b: number, c: RandomGenerator);
constructor
constructor(a: string, b?: number);
constructor
constructor(a: number[], b?: number);
constructor
constructor(a: BigInteger);
property data
data: number[];
property ONE
static ONE: BigInteger;
property s
s: number;
property t
t: number;
property ZERO
static ZERO: BigInteger;
method abs
abs: () => BigInteger;
method add
add: (a: BigInteger) => BigInteger;
method am
am: ( i: number, x: number, w: BigInteger, j: number, c: number, n: number) => number;
method and
and: (a: BigInteger) => BigInteger;
method andNot
andNot: (a: BigInteger) => BigInteger;
method bitCount
bitCount: () => number;
method bitLength
bitLength: { (): number; (): number };
method byteValue
byteValue: () => number;
method clearBit
clearBit: (n: number) => BigInteger;
method clone
clone: () => BigInteger;
method compareTo
compareTo: (a: BigInteger) => number;
method divide
divide: (a: BigInteger) => BigInteger;
method divideAndRemainder
divideAndRemainder: (a: BigInteger) => BigInteger[];
method equals
equals: (a: BigInteger) => boolean;
method flipBit
flipBit: (n: number) => BigInteger;
method gcd
gcd: (a: BigInteger) => BigInteger;
method getLowestSetBit
getLowestSetBit: () => number;
method intValue
intValue: () => number;
method isProbablePrime
isProbablePrime: (t: number) => boolean;
method max
max: (a: BigInteger) => BigInteger;
method min
min: (a: BigInteger) => BigInteger;
method mod
mod: (a: BigInteger) => BigInteger;
method modInverse
modInverse: (m: BigInteger) => BigInteger;
method modPow
modPow: (e: BigInteger, m: BigInteger) => BigInteger;
method modPowInt
modPowInt: (e: number, m: BigInteger) => BigInteger;
method multiply
multiply: (a: BigInteger) => BigInteger;
method negate
negate: () => BigInteger;
method not
not: () => BigInteger;
method or
or: (a: BigInteger) => BigInteger;
method pow
pow: (e: number) => BigInteger;
method remainder
remainder: (a: BigInteger) => BigInteger;
method shiftLeft
shiftLeft: (n: number) => BigInteger;
method shiftRight
shiftRight: (n: number) => BigInteger;
method shortValue
shortValue: () => number;
method signum
signum: () => number;
method squareTo
squareTo: (a: BigInteger) => BigInteger;
method subtract
subtract: (a: BigInteger) => BigInteger;
method testBit
testBit: (n: number) => boolean;
method toByteArray
toByteArray: () => number[];
method toString
toString: (b?: number) => string;
method xor
xor: (a: BigInteger) => BigInteger;
interface RandomGenerator
interface RandomGenerator {}
method nextBytes
nextBytes: (bytes: number[]) => void;
namespace node-forge.kem
namespace node-forge.kem {}
class kdf1
class kdf1 implements KDF {}
Creates a key derivation API object that implements KDF1 per ISO 18033-2.
Parameter md
the hash API to use.
Parameter digestLength
a digest length that must be positive and less than or equal to
md.digestLength
.a KDF1 API object.
constructor
constructor(md: md.MessageDigest, digestLength?: number);
method generate
generate: (x: string, length: number) => string;
Generate a key of the specified length.
Parameter x
the binary-encoded byte string to generate a key from.
Parameter length
the number of bytes to generate (the size of the key).
the key as a binary-encoded string.
class kdf2
class kdf2 implements KDF {}
Creates a key derivation API object that implements KDF2 per ISO 18033-2.
Parameter md
the hash API to use.
Parameter digestLength
a digest length that must be positive and less than or equal to
md.digestLength
.a KDF2 API object.
constructor
constructor(md: md.MessageDigest, digestLength?: number);
method generate
generate: (x: string, length: number) => string;
Generate a key of the specified length.
Parameter x
the binary-encoded byte string to generate a key from.
Parameter length
the number of bytes to generate (the size of the key).
the key as a binary-encoded string.
interface EncryptResult
interface EncryptResult {}
property encapsulation
encapsulation: string;
The ciphertext for generating the secret key, as a binary-encoded string of bytes.
property key
key: string;
The secret key to use for encrypting a message.
interface KDF
interface KDF {}
method generate
generate: (x: string, length: number) => string;
Generate a key of the specified length.
Parameter x
the binary-encoded byte string to generate a key from.
Parameter length
the number of bytes to generate (the size of the key).
the key as a binary-encoded string.
namespace node-forge.kem.rsa
namespace node-forge.kem.rsa {}
function create
create: (kdf: KDF, options?: Options) => kem;
Creates an RSA KEM API object for generating a secret asymmetric key.
The symmetric key may be generated via a call to 'encrypt', which will produce a ciphertext to be transmitted to the recipient and a key to be kept secret. The ciphertext is a parameter to be passed to 'decrypt' which will produce the same secret key for the recipient to use to decrypt a message that was encrypted with the secret key.
Parameter kdf
the KDF API to use (eg:
new forge.kem.kdf1()
).Parameter options
the options to use.
interface kem
interface kem {}
method decrypt
decrypt: ( privateKey: pki.rsa.PrivateKey, encapsulation: string, keyLength: number) => string;
Decrypts an encapsulated secret key.
Parameter privateKey
the RSA private key to decrypt with.
Parameter encapsulation
the ciphertext for generating the secret key, as a binary-encoded string of bytes.
Parameter keyLength
the length, in bytes, of the secret key to generate.
the secret key as a binary-encoded string of bytes.
method encrypt
encrypt: (publicKey: pki.rsa.PublicKey, keyLength: number) => EncryptResult;
Generates a secret key and its encapsulation.
Parameter publicKey
the RSA public key to encrypt with.
Parameter keyLength
the length, in bytes, of the secret key to generate.
interface Options
interface Options {}
property prng
prng?: random | undefined;
A custom crypto-secure pseudo-random number generator to use.
interface random
interface random {}
method getBytesSync
getBytesSync: (count: number) => Bytes;
namespace node-forge.md
namespace node-forge.md {}
interface MessageDigest
interface MessageDigest {}
property algorithm
readonly algorithm: Algorithm;
property blockLength
readonly blockLength: number;
property digestLength
readonly digestLength: number;
property fullMessageLength
fullMessageLength: number[] | null;
property messageLength
messageLength: number;
property messageLengthSize
readonly messageLengthSize: number;
method digest
digest: () => util.ByteStringBuffer;
method update
update: (msg: string, encoding?: Encoding) => this;
type Algorithm
type Algorithm = | md5.Algorithm | sha1.Algorithm | sha256.Algorithm | sha512.Algorithm;
namespace node-forge.md.md5
namespace node-forge.md.md5 {}
interface MessageDigest
interface MessageDigest extends md.MessageDigest {}
property algorithm
readonly algorithm: Algorithm;
property blockLength
readonly blockLength: 64;
property digestLength
readonly digestLength: 16;
property messageLengthSize
readonly messageLengthSize: 8;
type Algorithm
type Algorithm = 'md5';
namespace node-forge.md.sha1
namespace node-forge.md.sha1 {}
interface MessageDigest
interface MessageDigest extends md.MessageDigest {}
property algorithm
readonly algorithm: Algorithm;
property blockLength
readonly blockLength: 64;
property digestLength
readonly digestLength: 20;
property messageLengthSize
readonly messageLengthSize: 8;
type Algorithm
type Algorithm = 'sha1';
namespace node-forge.md.sha256
namespace node-forge.md.sha256 {}
interface MessageDigest
interface MessageDigest extends md.MessageDigest {}
property algorithm
readonly algorithm: Algorithm;
property blockLength
readonly blockLength: 64;
property digestLength
readonly digestLength: 32;
property messageLengthSize
readonly messageLengthSize: 8;
type Algorithm
type Algorithm = 'sha256';
namespace node-forge.md.sha512
namespace node-forge.md.sha512 {}
interface MessageDigest
interface MessageDigest extends md.MessageDigest {}
property algorithm
readonly algorithm: Algorithm;
property blockLength
readonly blockLength: 128;
property messageLengthSize
readonly messageLengthSize: 16;
interface Sha384MessageDigest
interface Sha384MessageDigest extends MessageDigest {}
property algorithm
readonly algorithm: Algorithm.Sha384;
property digestLength
readonly digestLength: 48;
interface Sha512224MessageDigest
interface Sha512224MessageDigest extends MessageDigest {}
property algorithm
readonly algorithm: Algorithm.Sha512224;
property digestLength
readonly digestLength: 28;
interface Sha512256MessageDigest
interface Sha512256MessageDigest extends MessageDigest {}
property algorithm
readonly algorithm: Algorithm.Sha512256;
property digestLength
readonly digestLength: 32;
interface Sha512MessageDigest
interface Sha512MessageDigest extends MessageDigest {}
property algorithm
readonly algorithm: Algorithm.Sha512;
property digestLength
readonly digestLength: 64;
type Algorithm
type Algorithm = | Algorithm.Sha384 | Algorithm.Sha512 | Algorithm.Sha512224 | Algorithm.Sha512256;
type AlgorithmSelection
type AlgorithmSelection = | AlgorithmSelection.Sha384 | AlgorithmSelection.Sha512 | AlgorithmSelection.Sha512224 | AlgorithmSelection.Sha512256;
namespace node-forge.md.sha512.Algorithm
namespace node-forge.md.sha512.Algorithm {}
namespace node-forge.md.sha512.AlgorithmSelection
namespace node-forge.md.sha512.AlgorithmSelection {}
namespace node-forge.mgf
namespace node-forge.mgf {}
namespace node-forge.mgf.mgf1
namespace node-forge.mgf.mgf1 {}
function create
create: (any: any) => any;
namespace node-forge.pem
namespace node-forge.pem {}
function decode
decode: (str: string) => ObjectPEM[];
function encode
encode: (msg: ObjectPEM, options?: EncodeOptions) => string;
interface EncodeOptions
interface EncodeOptions {}
property maxline
maxline?: number | undefined;
namespace node-forge.pkcs12
namespace node-forge.pkcs12 {}
function generateKey
generateKey: ( password: string | null | undefined, salt: util.ByteBuffer, id: Byte, iter: number, n: number, md?: md.MessageDigest) => util.ByteBuffer;
function pkcs12FromAsn1
pkcs12FromAsn1: { (obj: any, strict?: boolean, password?: string): Pkcs12Pfx; (obj: any, password?: string): Pkcs12Pfx;};
function toPkcs12Asn1
toPkcs12Asn1: ( key: pki.PrivateKey | null, cert: pki.Certificate | pki.Certificate[], password: string | null, options?: { algorithm?: 'aes128' | 'aes192' | 'aes256' | '3des' | undefined; count?: number | undefined; saltSize?: number | undefined; useMac?: boolean | undefined; localKeyId?: Hex | undefined; friendlyName?: string | undefined; generateLocalKeyId?: boolean | undefined; }) => asn1.Asn1;
interface Bag
interface Bag {}
property asn1
asn1: asn1.Asn1;
property attributes
attributes: any;
property cert
cert?: pki.Certificate | undefined;
property key
key?: pki.PrivateKey | undefined;
property type
type: string;
interface BagsFilter
interface BagsFilter {}
property bagType
bagType?: string | undefined;
property friendlyName
friendlyName?: string | undefined;
property localKeyId
localKeyId?: string | undefined;
property localKeyIdHex
localKeyIdHex?: string | undefined;
interface Pkcs12Pfx
interface Pkcs12Pfx {}
property getBags
getBags: (filter: BagsFilter) => { [key: string]: Bag[] | undefined; localKeyId?: Bag[] | undefined; friendlyName?: Bag[] | undefined;};
property getBagsByFriendlyName
getBagsByFriendlyName: (fiendlyName: string, bagType: string) => Bag[];
property getBagsByLocalKeyId
getBagsByLocalKeyId: (localKeyId: string, bagType: string) => Bag[];
property safeContents
safeContents: { encrypted: boolean; safeBags: Bag[];}[];
property version
version: string;
namespace node-forge.pkcs5
namespace node-forge.pkcs5 {}
function pbkdf2
pbkdf2: { (password: string, salt: string, iterations: number, keySize: number): string; ( password: string, salt: string, iterations: number, keySize: number, messageDigest: md.MessageDigest | md.Algorithm ): string; ( password: string, salt: string, iterations: number, keySize: number, callback: (err: Error, dk: string) => any ): void; ( password: string, salt: string, iterations: number, keySize: number, messageDigest?: md.MessageDigest | md.Algorithm, callback?: (err: Error, dk: string) => any ): void;};
namespace node-forge.pkcs7
namespace node-forge.pkcs7 {}
function createEnvelopedData
createEnvelopedData: () => PkcsEnvelopedData;
function createSignedData
createSignedData: () => PkcsSignedData;
function messageFromAsn1
messageFromAsn1: ( asn: asn1.Asn1) => Captured<PkcsEnvelopedData | PkcsSignedData>;
Converts a PKCS#7 message from an ASN.1 object.
Parameter asn
the ASN.1 representation of a ContentInfo.
the PKCS#7 message.
function messageFromPem
messageFromPem: (pem: pki.PEM) => Captured<PkcsEnvelopedData | PkcsSignedData>;
Converts a PKCS#7 message from PEM format.
Parameter pem
the PEM-formatted PKCS#7 message.
the PKCS#7 message.
function messageToPem
messageToPem: (msg: PkcsSignedData, maxline?: number) => string;
Converts a PKCS#7 message to PEM format.
Parameter msg
The PKCS#7 message object
Parameter maxline
The maximum characters per line, defaults to 64.
The PEM-formatted PKCS#7 message.
interface PkcsEnvelopedData
interface PkcsEnvelopedData {}
property content
content?: string | util.ByteBuffer | undefined;
method addRecipient
addRecipient: (certificate: pki.Certificate) => void;
method encrypt
encrypt: () => void;
method toAsn1
toAsn1: () => asn1.Asn1;
interface PkcsSignedData
interface PkcsSignedData {}
property certificates
certificates: pki.Certificate[];
property content
content?: string | util.ByteBuffer | undefined;
property contentInfo
contentInfo?: { value: any[] } | undefined;
method addCertificate
addCertificate: (certificate: pki.Certificate | string) => void;
method addSigner
addSigner: (options: { key: pki.rsa.PrivateKey | string; certificate: pki.Certificate | string; digestAlgorithm: string; authenticatedAttributes?: | { type: string; value?: string | undefined }[] | undefined;}) => void;
method sign
sign: (options?: { detached?: boolean | undefined }) => void;
method toAsn1
toAsn1: () => asn1.Asn1;
type Captured
type Captured<T> = T & { rawCapture: any;};
When a PKCS#7 object has been created by reading from a message, the raw captured object is joined
namespace node-forge.pki
namespace node-forge.pki {}
variable oids
var oids: oids;
variable setRsaPrivateKey
const setRsaPrivateKey: ( n: jsbn.BigInteger, e: jsbn.BigInteger, d: jsbn.BigInteger, p: jsbn.BigInteger, q: jsbn.BigInteger, dP: jsbn.BigInteger, dQ: jsbn.BigInteger, qInv: jsbn.BigInteger) => rsa.PrivateKey;
variable setRsaPublicKey
const setRsaPublicKey: (n: jsbn.BigInteger, e: jsbn.BigInteger) => rsa.PublicKey;
function certificateFromAsn1
certificateFromAsn1: (obj: asn1.Asn1, computeHash?: boolean) => Certificate;
function certificateFromPem
certificateFromPem: ( pem: PEM, computeHash?: boolean, strict?: boolean) => Certificate;
function certificateToAsn1
certificateToAsn1: (cert: Certificate) => asn1.Asn1;
function certificateToPem
certificateToPem: (cert: Certificate, maxline?: number) => PEM;
function certificationRequestFromAsn1
certificationRequestFromAsn1: ( obj: asn1.Asn1, computeHash?: boolean) => Certificate;
function certificationRequestFromPem
certificationRequestFromPem: ( pem: PEM, computeHash?: boolean, strict?: boolean) => Certificate;
function certificationRequestToAsn1
certificationRequestToAsn1: (cert: Certificate) => asn1.Asn1;
function certificationRequestToPem
certificationRequestToPem: (cert: Certificate, maxline?: number) => PEM;
function createCaStore
createCaStore: (certs?: ReadonlyArray<Certificate | pki.PEM>) => CAStore;
function createCertificate
createCertificate: () => Certificate;
function createCertificationRequest
createCertificationRequest: () => CertificateRequest;
function decryptPrivateKeyInfo
decryptPrivateKeyInfo: (obj: asn1.Asn1, password: string) => asn1.Asn1;
function decryptRsaPrivateKey
decryptRsaPrivateKey: { (pem: PEM, passphrase?: string): rsa.PrivateKey; (pem: string, password: string): rsa.PrivateKey;};
function encryptedPrivateKeyFromPem
encryptedPrivateKeyFromPem: (pem: PEM) => asn1.Asn1;
function encryptedPrivateKeyToPem
encryptedPrivateKeyToPem: (obj: asn1.Asn1) => PEM;
function encryptPrivateKeyInfo
encryptPrivateKeyInfo: ( obj: asn1.Asn1, password: string, options?: EncryptionOptions) => asn1.Asn1;
function encryptRsaPrivateKey
encryptRsaPrivateKey: ( privateKey: PrivateKey, password: string, options?: EncryptionOptions) => PEM;
function getPublicKeyFingerprint
getPublicKeyFingerprint: { ( publicKey: PublicKey, options?: ByteBufferFingerprintOptions ): util.ByteStringBuffer; (publicKey: any, options: HexFingerprintOptions): string; (publicKey: any, options: BinaryFingerprintOptions): string;};
function pemToDer
pemToDer: (pem: PEM) => util.ByteStringBuffer;
function privateKeyFromAsn1
privateKeyFromAsn1: (privateKey: asn1.Asn1) => PrivateKey;
function privateKeyFromPem
privateKeyFromPem: (pem: PEM) => rsa.PrivateKey;
function privateKeyInfoToPem
privateKeyInfoToPem: (key: asn1.Asn1, maxline?: number) => PEM;
function privateKeyToAsn1
privateKeyToAsn1: (privateKey: PrivateKey) => asn1.Asn1;
function privateKeyToPem
privateKeyToPem: (key: PrivateKey, maxline?: number) => PEM;
function publicKeyFromAsn1
publicKeyFromAsn1: (publicKey: asn1.Asn1) => PublicKey;
function publicKeyFromPem
publicKeyFromPem: (pem: PEM) => rsa.PublicKey;
function publicKeyToAsn1
publicKeyToAsn1: (publicKey: PublicKey) => asn1.Asn1;
function publicKeyToPem
publicKeyToPem: (key: PublicKey, maxline?: number) => PEM;
function publicKeyToRSAPublicKey
publicKeyToRSAPublicKey: (publicKey: PublicKey) => any;
function publicKeyToRSAPublicKeyPem
publicKeyToRSAPublicKeyPem: (key: PublicKey, maxline?: number) => PEM;
function verifyCertificateChain
verifyCertificateChain: ( caStore: CAStore, chain: Certificate[], options?: | (( verified: boolean | string, depth: number, certs: Certificate[] ) => boolean) | { verify?: ( verified: boolean | string, depth: number, certs: Certificate[] ) => boolean; validityCheckDate?: Date | null | undefined; }) => boolean;
function wrapRsaPrivateKey
wrapRsaPrivateKey: (privateKey: asn1.Asn1) => asn1.Asn1;
interface Attribute
interface Attribute {}
property extensions
extensions?: any[] | undefined;
Extensions
property name
name: string;
e.g. challengePassword
property shortName
shortName?: string | undefined;
Short name, if available (e.g. 'CN' for 'commonName')
property type
type: string;
OID, e.g. '1.2.840.113549.1.9.7'
property value
value: any;
Attribute value
property valueTagClass
valueTagClass: number;
Attribute value data type
interface BinaryFingerprintOptions
interface BinaryFingerprintOptions extends ByteBufferFingerprintOptions {}
property encoding
encoding: 'binary';
if not specified, the function will return
ByteStringBuffer
interface ByteBufferFingerprintOptions
interface ByteBufferFingerprintOptions {}
property delimiter
delimiter?: string | undefined;
the delimiter to use between bytes for
hex
encoded output
property md
md?: md.MessageDigest | undefined;
if not specified defaults to
md.md5
property type
type?: 'SubjectPublicKeyInfo' | 'RSAPublicKey' | undefined;
The type of fingerprint. If not specified, defaults to 'RSAPublicKey'
interface CAStore
interface CAStore {}
method addCertificate
addCertificate: (cert: Certificate | string) => void;
method getBySubject
getBySubject: (subject: string) => Certificate | null;
method getIssuer
getIssuer: (subject: Certificate) => Certificate | null;
method hasCertificate
hasCertificate: (cert: Certificate | string) => boolean;
method listAllCertificates
listAllCertificates: () => pki.Certificate[];
method removeCertificate
removeCertificate: (cert: Certificate | string) => Certificate | null;
interface Certificate
interface Certificate {}
property extensions
extensions: any[];
property issuer
issuer: { getField(sn: string | CertificateFieldOptions): any; addField(attr: CertificateField): void; attributes: CertificateField[]; hash: any;};
property md
md: md.MessageDigest;
property privateKey
privateKey: PrivateKey;
property publicKey
publicKey: PublicKey;
property serialNumber
serialNumber: string;
property siginfo
siginfo: { algorithmOid: string; parameters: any;};
property signature
signature: any;
property signatureOid
signatureOid: string;
property signatureParameters
signatureParameters: any;
property subject
subject: { getField(sn: string | CertificateFieldOptions): any; addField(attr: CertificateField): void; attributes: CertificateField[]; hash: any;};
property tbsCertificate
tbsCertificate: asn1.Asn1;
property validity
validity: { notBefore: Date; notAfter: Date;};
property version
version: number;
method generateSubjectKeyIdentifier
generateSubjectKeyIdentifier: () => util.ByteStringBuffer;
Generates the subjectKeyIdentifier for this certificate as byte buffer.
the subjectKeyIdentifier for this certificate as byte buffer.
method getExtension
getExtension: ( options: string | { name: string } | { id: number }) => {} | undefined;
Gets an extension by its name or id.
Parameter options
the name to use or an object with: name the name to use. id the id to use.
the extension or null if not found.
method isIssuer
isIssuer: (parent: Certificate) => boolean;
Returns true if this certificate's issuer matches the passed certificate's subject. Note that no signature check is performed.
Parameter parent
the certificate to check.
true if this certificate's issuer matches the passed certificate's subject.
method issued
issued: (child: Certificate) => boolean;
Returns true if this certificate's subject matches the issuer of the given certificate). Note that not signature check is performed.
Parameter child
the certificate to check.
true if this certificate's subject matches the passed certificate's issuer.
method setExtensions
setExtensions: (exts: any[]) => void;
Sets the extensions of this certificate.
Parameter exts
the array of extensions to use.
method setIssuer
setIssuer: (attrs: CertificateField[], uniqueId?: string) => void;
Sets the issuer of this certificate.
Parameter attrs
the array of subject attributes to use.
Parameter uniqueId
an optional a unique ID to use.
method setSubject
setSubject: (attrs: CertificateField[], uniqueId?: string) => void;
Sets the subject of this certificate.
Parameter attrs
the array of subject attributes to use.
Parameter uniqueId
an optional a unique ID to use.
method sign
sign: (key: pki.PrivateKey, md?: md.MessageDigest) => void;
Signs this certificate using the given private key.
Parameter key
the private key to sign with.
Parameter md
the message digest object to use (defaults to forge.md.sha1).
method verify
verify: (child: Certificate) => boolean;
Attempts verify the signature on the passed certificate using this certificate's public key.
Parameter child
the certificate to verify.
true if verified, false if not.
method verifySubjectKeyIdentifier
verifySubjectKeyIdentifier: () => boolean;
Verifies the subjectKeyIdentifier extension value for this certificate against its public key. If no extension is found, false will be returned.
true if verified, false if not.
interface CertificateField
interface CertificateField extends CertificateFieldOptions {}
property extensions
extensions?: any[] | undefined;
property value
value?: any[] | string | undefined;
property valueConstructed
valueConstructed?: boolean | undefined;
property valueTagClass
valueTagClass?: asn1.Class | undefined;
interface CertificateFieldOptions
interface CertificateFieldOptions {}
interface CertificateRequest
interface CertificateRequest extends Certificate {}
method getAttribute
getAttribute: (opts: string | GetAttributeOpts) => Attribute | null;
Gets an issuer or subject attribute from its name, type, or short name.
Parameter opts
a short name string or an object with: shortName the short name for the attribute. name the name for the attribute. type the type for the attribute.
the attribute.
interface GetAttributeOpts
interface GetAttributeOpts {}
Attribute members to search on; any one hit will return the attribute
interface HexFingerprintOptions
interface HexFingerprintOptions extends ByteBufferFingerprintOptions {}
property encoding
encoding: 'hex';
if not specified, the function will return
ByteStringBuffer
interface KeyPair
interface KeyPair {}
property privateKey
privateKey: PrivateKey;
property publicKey
publicKey: PublicKey;
interface oids
interface oids {}
index signature
[key: string]: string;
type EncryptionOptions
type EncryptionOptions = { algorithm?: 'aes128' | 'aes192' | 'aes256' | '3des' | undefined; count?: number | undefined; saltSize?: number | undefined; prfAlgorithm?: 'sha1' | 'sha224' | 'sha256' | 'sha384' | 'sha512' | undefined; legacy?: boolean | undefined;};
type PEM
type PEM = string;
type PrivateKey
type PrivateKey = rsa.PrivateKey | ed25519.Key;
type PublicKey
type PublicKey = rsa.PublicKey | ed25519.Key;
namespace node-forge.pki.ed25519
namespace node-forge.pki.ed25519 {}
function generateKeyPair
generateKeyPair: (options?: { seed?: NativeBuffer | string | undefined }) => { publicKey: NativeBuffer; privateKey: NativeBuffer;};
function privateKeyFromAsn1
privateKeyFromAsn1: (obj: asn1.Asn1) => { privateKeyBytes: NativeBuffer };
function publicKeyFromAsn1
publicKeyFromAsn1: (obj: asn1.Asn1) => NativeBuffer;
function publicKeyFromPrivateKey
publicKeyFromPrivateKey: (options: { privateKey: BinaryBuffer }) => NativeBuffer;
function sign
sign: ( options: ToNativeBufferParameters & { privateKey: BinaryBuffer }) => NativeBuffer;
function verify
verify: ( options: ToNativeBufferParameters & { signature: BinaryBuffer; publicKey: BinaryBuffer; }) => boolean;
type BinaryBuffer
type BinaryBuffer = NativeBuffer | util.ByteBuffer | string;
type Key
type Key = NativeBuffer;
type NativeBuffer
type NativeBuffer = Buffer | Uint8Array;
type ToNativeBufferParameters
type ToNativeBufferParameters = | { md: md.MessageDigest; } | { message: NativeBuffer | util.ByteBuffer; } | { message: string; encoding: 'binary' | 'utf8'; };
namespace node-forge.pki.ed25519.constants
namespace node-forge.pki.ed25519.constants {}
variable HASH_BYTE_LENGTH
const HASH_BYTE_LENGTH: number;
variable PRIVATE_KEY_BYTE_LENGTH
const PRIVATE_KEY_BYTE_LENGTH: number;
variable PUBLIC_KEY_BYTE_LENGTH
const PUBLIC_KEY_BYTE_LENGTH: number;
variable SEED_BYTE_LENGTH
const SEED_BYTE_LENGTH: number;
variable SIGN_BYTE_LENGTH
const SIGN_BYTE_LENGTH: number;
namespace node-forge.pki.rsa
namespace node-forge.pki.rsa {}
function generateKeyPair
generateKeyPair: { ( bits?: number, e?: number, callback?: (err: Error, keypair: KeyPair) => void ): KeyPair; ( options?: GenerateKeyPairOptions, callback?: (err: Error, keypair: KeyPair) => void ): KeyPair;};
function setPrivateKey
setPrivateKey: ( n: jsbn.BigInteger, e: jsbn.BigInteger, d: jsbn.BigInteger, p: jsbn.BigInteger, q: jsbn.BigInteger, dP: jsbn.BigInteger, dQ: jsbn.BigInteger, qInv: jsbn.BigInteger) => PrivateKey;
function setPublicKey
setPublicKey: (n: jsbn.BigInteger, e: jsbn.BigInteger) => PublicKey;
interface GenerateKeyPairOptions
interface GenerateKeyPairOptions {}
interface KeyPair
interface KeyPair {}
property privateKey
privateKey: PrivateKey;
property publicKey
publicKey: PublicKey;
interface PrivateKey
interface PrivateKey {}
property d
d: jsbn.BigInteger;
property dP
dP: jsbn.BigInteger;
property dQ
dQ: jsbn.BigInteger;
property e
e: jsbn.BigInteger;
property n
n: jsbn.BigInteger;
property p
p: jsbn.BigInteger;
property q
q: jsbn.BigInteger;
property qInv
qInv: jsbn.BigInteger;
method decrypt
decrypt: (data: Bytes, scheme?: EncryptionScheme, schemeOptions?: any) => Bytes;
method sign
sign: (md: md.MessageDigest | Bytes, scheme?: SignatureScheme) => Bytes;
interface PublicKey
interface PublicKey {}
type EncryptionScheme
type EncryptionScheme = 'RSAES-PKCS1-V1_5' | 'RSA-OAEP' | 'RAW' | 'NONE' | null;
type SignatureScheme
type SignatureScheme = 'RSASSA-PKCS1-V1_5' | pss.PSS | 'NONE' | null;
namespace node-forge.pss
namespace node-forge.pss {}
namespace node-forge.random
namespace node-forge.random {}
function createInstance
createInstance: () => Random;
function getBytes
getBytes: ( count: number, callback?: (err: Error | null, bytes: Bytes) => any) => void;
function getBytesSync
getBytesSync: (count: number) => Bytes;
interface Random
interface Random {}
property seedFile
seedFile: (needed: number, cb: CB) => void;
property seedFileSync
seedFileSync: (needed: number) => string;
type CB
type CB = (_: any, seed: string) => void;
namespace node-forge.rc2
namespace node-forge.rc2 {}
function createDecryptionCipher
createDecryptionCipher: ( key: string | util.ByteBuffer, bits?: number) => rc2.cipher;
function createEncryptionCipher
createEncryptionCipher: ( key: string | util.ByteBuffer, bits?: number) => rc2.cipher;
function expandKey
expandKey: ( key: string | util.ByteBuffer, effKeyBits?: number) => util.ByteBuffer;
function startDecrypting
startDecrypting: ( key: string | util.ByteBuffer, iv: util.ByteBuffer | Byte[] | Bytes, output: util.ByteBuffer | null) => rc2.cipher;
function startEncrypting
startEncrypting: ( key: string | util.ByteBuffer, iv: util.ByteBuffer | Byte[] | Bytes, output: util.ByteBuffer | null) => rc2.cipher;
interface cipher
interface cipher {}
type pad_function
type pad_function = ( blockSize: number, buffer: util.ByteBuffer, decrypt: boolean) => boolean;
namespace node-forge.ssh
namespace node-forge.ssh {}
function getPublicKeyFingerprint
getPublicKeyFingerprint: ( publicKey: pki.PublicKey, options?: FingerprintOptions) => util.ByteStringBuffer | Hex | string;
Gets the SSH fingerprint for the given public key
function privateKeyToOpenSSH
privateKeyToOpenSSH: (privateKey: pki.PrivateKey, passphrase?: string) => string;
Encodes a private RSA key as an OpenSSH file
function privateKeyToPutty
privateKeyToPutty: ( privateKey: pki.PrivateKey, passphrase?: string, comment?: string) => string;
Encodes (and optionally encrypts) a private RSA key as a Putty PPK file
function publicKeyToOpenSSH
publicKeyToOpenSSH: ( publicKey: pki.PublicKey, comment?: string) => string | pki.PEM;
Encodes a public RSA key as an OpenSSH file
interface FingerprintOptions
interface FingerprintOptions {}
property delimiter
delimiter?: string | undefined;
the delimiter to use between bytes for
hex
encoded output
property encoding
encoding?: 'hex' | 'binary' | undefined;
if not specified, the function will return
ByteStringBuffer
property md
md?: md.MessageDigest | undefined;
if not specified defaults to
md.md5
namespace node-forge.tls
namespace node-forge.tls {}
variable CipherSuites
const CipherSuites: { [name: string]: CipherSuite };
variable MaxFragment
const MaxFragment: number;
variable SupportedVersions
const SupportedVersions: ProtocolVersion[];
variable Version
const Version: ProtocolVersion;
variable Versions
const Versions: ProtocolVersion[];
function createConnection
createConnection: (options: { server?: boolean | undefined; sessionId?: Bytes | null | undefined; caStore?: pki.CAStore | ReadonlyArray<pki.Certificate> | undefined; sessionCache?: SessionCache | { [key: string]: Session }; cipherSuites?: CipherSuite[] | undefined; connected(conn: Connection): void; virtualHost?: string | undefined; verifyClient?: boolean | undefined; verify?( conn: Connection, verified: Verified, depth: number, certs: pki.Certificate[] ): Verified; getCertificate?( conn: Connection, hint: CertificateRequest | string[] ): pki.PEM | ReadonlyArray<pki.PEM>; getPrivateKey?(conn: Connection, certificate: pki.Certificate): pki.PEM; getSignature?( conn: Connection, bytes: Bytes, callback: (conn: Connection, bytes: Bytes) => void ): void; tlsDataReady(conn: Connection): void; dataReady(conn: Connection): void; heartbeatReceived?(conn: Connection, payload: util.ByteBuffer): void; closed(conn: Connection): void; error(conn: Connection, error: TLSError): void; deflate?(inBytes: Bytes): Bytes; inflate?(inBytes: Bytes): Bytes;}) => Connection;
function createSessionCache
createSessionCache: ( cache?: SessionCache | { [key: string]: Session }, capacity?: number) => SessionCache;
function hmac_sha1
hmac_sha1: ( key: string | ReadonlyArray<Byte> | util.ByteBuffer, seqNum: [number, number], record: Record) => Bytes;
function prf_tls1
prf_tls1: ( secret: string, label: string, seed: string, length: number) => util.ByteBuffer;
interface Alert
interface Alert {}
property description
description: Alert.Description;
property level
level: Alert.Level;
interface CertificateRequest
interface CertificateRequest {}
property certificate_authorities
certificate_authorities: util.ByteBuffer;
property certificate_types
certificate_types: util.ByteBuffer;
interface CipherSuite
interface CipherSuite {}
interface Connection
interface Connection {}
property caStore
caStore: pki.CAStore;
property cipherSuites
cipherSuites: CipherSuite[];
property data
data: util.ByteBuffer;
property deflate
deflate: ((inBytes: Bytes) => Bytes) | null;
property entity
entity: ConnectionEnd;
property expect
expect: number;
property fail
fail: boolean;
property fragmented
fragmented: Record | null;
property getCertificate
getCertificate: | (( conn: Connection, hint: CertificateRequest | string[] ) => pki.PEM | ReadonlyArray<pki.PEM>) | null;
property getPrivateKey
getPrivateKey: | ((conn: Connection, certificate: pki.Certificate) => pki.PEM) | null;
property getSignature
getSignature: | (( conn: Connection, bytes: Bytes, callback: (conn: Connection, bytes: Bytes) => void ) => void) | null;
property handshakes
handshakes: number;
property handshaking
handshaking: boolean;
property heartbeatReceived
heartbeatReceived: | ((conn: Connection, payload: util.ByteBuffer) => void) | undefined;
property inflate
inflate: ((inBytes: Bytes) => Bytes) | null;
property input
input: util.ByteBuffer;
property isConnected
isConnected: boolean;
property open
open: boolean;
property peerCertificate
peerCertificate: pki.Certificate | null;
property record
record: Record | null;
property records
records: Record[];
property session
session: Session | null;
property sessionCache
sessionCache: SessionCache | null;
property sessionId
sessionId: Bytes | null;
property state
state: { pending: ConnectionState | null; current: ConnectionState };
property tlsData
tlsData: util.ByteBuffer;
property verifyClient
verifyClient: boolean;
property version
version: ProtocolVersion;
property virtualHost
virtualHost: string | null;
method close
close: (clearFail?: boolean) => Connection;
method closed
closed: (conn: Connection) => void;
method connected
connected: (conn: Connection) => void;
method dataReady
dataReady: (conn: Connection) => void;
method error
error: (conn: Connection, error: TLSError) => void;
method handshake
handshake: (sessionId?: Bytes | null) => void;
method prepare
prepare: (data: Bytes) => boolean;
method prepareHeartbeatRequest
prepareHeartbeatRequest: ( payload: Bytes | util.ByteBuffer, payloadLength?: number) => boolean;
method process
process: (data: Bytes) => number;
method reset
reset: (clearFail?: boolean) => void;
method tlsDataReady
tlsDataReady: (conn: Connection) => void;
method verify
verify: ( conn: Connection, verified: Verified, depth: number, certs: pki.Certificate[]) => Verified;
interface ProtocolVersion
interface ProtocolVersion {}
interface Record
interface Record {}
interface Session
interface Session {}
property cipherSuite
cipherSuite: CipherSuite | null;
property clientCertificate
clientCertificate: pki.Certificate | null;
property compressionMethod
compressionMethod: CompressionMethod | null;
property extensions
extensions: { [_: string]: object };
property md5
md5: md.MessageDigest;
property serverCertificate
serverCertificate: pki.Certificate | null;
property sha1
sha1: md.MessageDigest;
property version
version: ProtocolVersion | null;
interface SessionCache
interface SessionCache {}
property cache
cache: { [key: string]: Session };
property capacity
capacity: number;
property order
order: [Hex];
method getSession
getSession: (sessionId: Bytes) => Session;
method setSession
setSession: (sessionId: Bytes, session: Session) => void;
interface TLSError
interface TLSError extends Error {}
enum BulkCipherAlgorithm
enum BulkCipherAlgorithm { rc4 = 0, des3 = 1, aes = 2,}
enum CipherType
enum CipherType { stream = 0, block = 1, aead = 2,}
enum CompressionMethod
enum CompressionMethod { none = 0, deflate = 1,}
enum ConnectionEnd
enum ConnectionEnd { server = 0, client = 1,}
enum ContentType
enum ContentType { change_cipher_spec = 20, alert = 21, handshake = 22, application_data = 23, heartbeat = 24,}
member alert
alert = 21
member application_data
application_data = 23
member change_cipher_spec
change_cipher_spec = 20
member handshake
handshake = 22
member heartbeat
heartbeat = 24
enum HandshakeType
enum HandshakeType { hello_request = 0, client_hello = 1, server_hello = 2, certificate = 11, server_key_exchange = 12, certificate_request = 13, server_hello_done = 14, certificate_verify = 15, client_key_exchange = 16, finished = 20,}
member certificate
certificate = 11
member certificate_request
certificate_request = 13
member certificate_verify
certificate_verify = 15
member client_hello
client_hello = 1
member client_key_exchange
client_key_exchange = 16
member finished
finished = 20
member hello_request
hello_request = 0
member server_hello
server_hello = 2
member server_hello_done
server_hello_done = 14
member server_key_exchange
server_key_exchange = 12
enum HeartbeatMessageType
enum HeartbeatMessageType { heartbeat_request = 1, heartbeat_response = 2,}
member heartbeat_request
heartbeat_request = 1
member heartbeat_response
heartbeat_response = 2
enum MACAlgorithm
enum MACAlgorithm { hmac_md5 = 0, hmac_sha1 = 1, hmac_sha256 = 2, hmac_sha384 = 3, hmac_sha512 = 4,}
member hmac_md5
hmac_md5 = 0
member hmac_sha1
hmac_sha1 = 1
member hmac_sha256
hmac_sha256 = 2
member hmac_sha384
hmac_sha384 = 3
member hmac_sha512
hmac_sha512 = 4
enum PRFAlgorithm
enum PRFAlgorithm { tls_prf_sha256 = 0,}
member tls_prf_sha256
tls_prf_sha256 = 0
type ConnectionState
type ConnectionState = any;
type Verified
type Verified = | true | { message?: string | undefined; alert?: Alert.Description | undefined };
namespace node-forge.tls.Alert
namespace node-forge.tls.Alert {}
enum Description
enum Description { close_notify = 0, unexpected_message = 10, bad_record_mac = 20, decryption_failed = 21, record_overflow = 22, decompression_failure <