@ibm/mapepire-js
Version:
Db2 client for node
28 lines (27 loc) • 1.54 kB
TypeScript
/// <reference types="node" />
import tls from 'tls';
import { DaemonServer } from './types';
/**
* Retrieves the SSL/TLS certificate from a specified DB2 server.
*
* This function establishes a secure connection to the server and retrieves the peer certificate
* information, which includes details about the server's SSL/TLS certificate.
*
* @param server - An object containing the server details, including the host and port.
* @returns A promise that resolves to the detailed peer certificate information.
* @throws An error if the connection fails or if there is an issue retrieving the certificate.
*/
export declare function getCertificate(server: DaemonServer): Promise<tls.DetailedPeerCertificate>;
/**
* This function returns the root certificate in the certificate chain which can be used
* as the trusted CA certificate when creating the secure connection.
*
* It returns undefined when the root certificate is a publicly trusted CA. So it will not
* override the default trusted CA certificate for secure connection to eliminate the potential
* security attacks which are caused by always trusting the certificate returned by the server.
*
* @param server - An object containing the server details, including the host and port.
* @returns A promise that resolves to a X.509 certificate with PEM format
*/
export declare function getRootCertificate(server: DaemonServer): Promise<string | undefined>;
export declare function isSameCertificate(subject: tls.Certificate, issuer: tls.Certificate): boolean;