Skip to main content

Local certificate

Generating a local certificate

import {
KeyClient,
KeyType,
LocalCertificateParams,
SubjectCertificateParams,
} from '@bloock/sdk';

const keyClient = new KeyClient();

// Load a managed key
const _certificate = await keyClient.newLocalCertificate(
new LocalCertificateParams(
KeyType.Rsa2048,
new SubjectCertificateParams('Bloock'),
'password',
2
)
);

Loading an existing local certificate

import { KeyClient } from '@bloock/sdk';
import * as fs from 'fs';
import path from 'path';

const keyClient = new KeyClient();

// Load a local certificate
const dirPath = path.join(__dirname, '/certificate.p12');
const buffer = fs.readFileSync(dirPath);

const _certificate = await keyClient.loadLocalCertificate(buffer, 'password');