Home Reference Source

Function

Static Public Summary
public

Create CMS ECDSA signature from WebCrypto ECDSA signature

public

createECDSASignatureFromCMS(cmsSignature: Sequence): ArrayBuffer

Create a single ArrayBuffer from CMS ECDSA signature

public

Get WebCrypto algorithm by wel-known OID

public

getAlgorithmParameters(algorithmName: string, operation: string): *

Get default algorithm parameters for each kind of operation

public

getCrypto(): * | null

Get crypto subtle from current "crypto engine" or "undefined"

public

getEngine(): *

public

Getting hash algorithm by signature algorithm

public

Get OID for each specific algorithm

public

Initialize input Uint8Array by random values (with help from current "crypto engine")

public

kdf(hashFunction: string, Zbuffer: ArrayBuffer, keydatalen: number, SharedInfo: ArrayBuffer): *

ANS X9.63 Key Derivation Function

public

kdfWithCounter(hashFunction: string, Zbuffer: ArrayBuffer, Counter: number, SharedInfo: ArrayBuffer): *

ANS X9.63 Key Derivation Function having a "Counter" as a parameter

public

setEngine(name: *, crypto: *, subtle: *)

public

stringPrep(inputString: string): string

String preparation function.

public

async verifySCTsForCertificate(certificate: Certificate, issuerCertificate: Certificate, logs: Object[], index: Number): Array

Verify SignedCertificateTimestamp for specific certificate content

Static Public

public createCMSECDSASignature(signatureBuffer: ArrayBuffer): ArrayBuffer source

import {createCMSECDSASignature} from 'pkijs/src/common.js'

Create CMS ECDSA signature from WebCrypto ECDSA signature

Params:

NameTypeAttributeDescription
signatureBuffer ArrayBuffer

WebCrypto result of "sign" function

Return:

ArrayBuffer

public createECDSASignatureFromCMS(cmsSignature: Sequence): ArrayBuffer source

import {createECDSASignatureFromCMS} from 'pkijs/src/common.js'

Create a single ArrayBuffer from CMS ECDSA signature

Params:

NameTypeAttributeDescription
cmsSignature Sequence

ASN.1 SEQUENCE contains CMS ECDSA signature

Return:

ArrayBuffer

public getAlgorithmByOID(oid: string): Object source

import {getAlgorithmByOID} from 'pkijs/src/common.js'

Get WebCrypto algorithm by wel-known OID

Params:

NameTypeAttributeDescription
oid string

well-known OID to search for

Return:

Object

public getAlgorithmParameters(algorithmName: string, operation: string): * source

import {getAlgorithmParameters} from 'pkijs/src/common.js'

Get default algorithm parameters for each kind of operation

Params:

NameTypeAttributeDescription
algorithmName string

Algorithm name to get common parameters for

operation string

Kind of operation: "sign", "encrypt", "generatekey", "importkey", "exportkey", "verify"

Return:

*

public getCrypto(): * | null source

import {getCrypto} from 'pkijs/src/common.js'

Get crypto subtle from current "crypto engine" or "undefined"

Return:

* | null

public getEngine(): * source

import {getEngine} from 'pkijs/src/common.js'

Return:

*

public getHashAlgorithm(signatureAlgorithm: AlgorithmIdentifier): string source

import {getHashAlgorithm} from 'pkijs/src/common.js'

Getting hash algorithm by signature algorithm

Params:

NameTypeAttributeDescription
signatureAlgorithm AlgorithmIdentifier

Signature algorithm

Return:

string

public getOIDByAlgorithm(algorithm: Object): string source

import {getOIDByAlgorithm} from 'pkijs/src/common.js'

Get OID for each specific algorithm

Params:

NameTypeAttributeDescription
algorithm Object

Return:

string

public getRandomValues(view: Uint8Array): * source

import {getRandomValues} from 'pkijs/src/common.js'

Initialize input Uint8Array by random values (with help from current "crypto engine")

Params:

NameTypeAttributeDescription
view Uint8Array
  • nullable: false

Return:

*

public kdf(hashFunction: string, Zbuffer: ArrayBuffer, keydatalen: number, SharedInfo: ArrayBuffer): * source

import {kdf} from 'pkijs/src/common.js'

ANS X9.63 Key Derivation Function

Params:

NameTypeAttributeDescription
hashFunction string

Used hash function

Zbuffer ArrayBuffer

ArrayBuffer containing ECDH shared secret to derive from

keydatalen number

Length (!!! in BITS !!!) of used kew derivation function

SharedInfo ArrayBuffer

Usually DER encoded "ECC_CMS_SharedInfo" structure

Return:

*

public kdfWithCounter(hashFunction: string, Zbuffer: ArrayBuffer, Counter: number, SharedInfo: ArrayBuffer): * source

import {kdfWithCounter} from 'pkijs/src/common.js'

ANS X9.63 Key Derivation Function having a "Counter" as a parameter

Params:

NameTypeAttributeDescription
hashFunction string

Used hash function

Zbuffer ArrayBuffer

ArrayBuffer containing ECDH shared secret to derive from

Counter number
SharedInfo ArrayBuffer

Usually DER encoded "ECC_CMS_SharedInfo" structure

Return:

*

public setEngine(name: *, crypto: *, subtle: *) source

import {setEngine} from 'pkijs/src/common.js'

Params:

NameTypeAttributeDescription
name *
crypto *
subtle *

public stringPrep(inputString: string): string source

import {stringPrep} from 'pkijs/src/common.js'

String preparation function. In a future here will be realization of algorithm from RFC4518

Params:

NameTypeAttributeDescription
inputString string

JavaScript string. As soon as for each ASN.1 string type we have a specific transformation function here we will work with pure JavaScript string

Return:

string

Formated string

public async verifySCTsForCertificate(certificate: Certificate, issuerCertificate: Certificate, logs: Object[], index: Number): Array source

import {verifySCTsForCertificate} from 'pkijs/src/SignedCertificateTimestampList.js'

Verify SignedCertificateTimestamp for specific certificate content

Params:

NameTypeAttributeDescription
certificate Certificate

Certificate for which verification would be performed

issuerCertificate Certificate

Certificate of the issuer of target certificate

logs Object[]

Array of objects with information about each CT Log (like here: https://ct.grahamedgecombe.com/logs.json)

logs.log_id String

Identifier of the CT Log encoded in BASE-64 format

logs.key String

Public key of the CT Log encoded in BASE-64 format

index Number
  • optional
  • default: -1

Index of SignedCertificateTimestamp inside SignedCertificateTimestampList (for -1 would verify all)

Return:

Array

Array of verification results