Overview | File | Class | Tree | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## Class PKIXCommon

    Object
       |
       +--PKIXCommon

class PKIXCommon

Defined in pkixcommon.js

Field Summary
`<static> Object` | `cRLSign`
`<static> Object` | `dataEncipherment`
`<static> Object` | `decipherOnly`
`<static> Object` | `digitalSignature`
`<static> Object` | `encipherOnly`
`<static> Object` | `keyAgreement`
`<static> Object` | `keyCertSign`
`<static> Object` | `keyEncipherment`
`<static> Object` | `nonRepudiation`

Constructor Summary
`PKIXCommon()` Common functions and constants

Method Summary
`<static> Date` | `addDays(<Date> d, <Number> days)` Add the specified number of days to a date object
`<static> void` | `addNames(<ASN1> t, <Object> name)` Adds names from the name object to the RDNSequence.
`<static> ByteString` | `bitstringForInteger(<Number> val)` Converts the integer value into a BIT STRING value.
`<static> ByteString` | `convertUnsignedInteger(<ByteString> value)` Removes leading zeros and prepends a single '00' to ByteStrings which have the most significant bit set.
`<static> ASN1` | `createECSubjectPublicKeyInfo(publicKey, encodeECDomainParameter)` Creates the EC Public Key as subjectPublicKeyInfo TLV structure object.
`<static> ASN1` | `createRSASubjectPublicKeyInfo(publicKey)` Creates the RSA Public Key as subjectPublicKeyInfo TLV structure object.
`<static> String` | `dtoUTC(<Date> d)` Convert date and time to UTC string with format YYMMDDHHMMSSZ.
`<static> ASN1` | `encodeName(<Object> name)` Gets the dn as TLV object
`<static> Object` | `makeRDN(<String> name, <String> oid, <ASN1> value)` Creates a relative distinguished name component.
`<static> ByteString` | `readFileFromDisk(<String> filename)` Loads a binary file from disk
`<static> void` | `test()`
`<static> void` | `writeFileToDisk(<String> filename, <ByteString> content)` Writes a byte string object to file

Field Detail

### cRLSign

    <static> Object cRLSign

### dataEncipherment

    <static> Object dataEncipherment

### decipherOnly

    <static> Object decipherOnly

### digitalSignature

    <static> Object digitalSignature

### encipherOnly

    <static> Object encipherOnly

### keyAgreement

    <static> Object keyAgreement

### keyCertSign

    <static> Object keyCertSign

### keyEncipherment

    <static> Object keyEncipherment

### nonRepudiation

    <static> Object nonRepudiation

Constructor Detail

### PKIXCommon

    PKIXCommon()

Common functions and constants

Method Detail

### addDays

    <static> Date addDays(<Date> d, <Number> days)

Add the specified number of days to a date object

Parameters:

`d` - the date object

`days` - the number of days to add, may be negative

Returns:

a new Date object

### addNames

    <static> void addNames(<ASN1> t, <Object> name)

Adds names from the name object to the RDNSequence.

Parameters:

`t` - the sequence object

`name` - the name object

### bitstringForInteger

    <static> ByteString bitstringForInteger(<Number> val)

Converts the integer value into a BIT STRING value.

The function interprets the integer value as bitmap, where bit 0 is the most significant bit of the least significant byte.

The function adds the minimum number of bytes to the final bit string and encodes the "number of unused bits at the beginning.

Parameters:

`val` - the value to convert

Returns:

the bit string

### convertUnsignedInteger

    <static> ByteString convertUnsignedInteger(<ByteString> value)

Removes leading zeros and prepends a single '00' to ByteStrings which have the most significant bit set. This prevent interpretation of the integer representation if converted into a signed ASN1 INTEGER.

Parameters:

`value` - the value to convert

Returns:

the converted value

### createECSubjectPublicKeyInfo

    <static> ASN1 createECSubjectPublicKeyInfo(publicKey, encodeECDomainParameter)

Creates the EC Public Key as subjectPublicKeyInfo TLV structure object.

The structure is defined as:

    	SubjectPublicKeyInfo  ::=  SEQUENCE  {
    		algorithm            AlgorithmIdentifier,
    		subjectPublicKey     BIT STRING  }

    	AlgorithmIdentifier  ::=  SEQUENCE  {
    		algorithm               OBJECT IDENTIFIER,
    		parameters              ANY DEFINED BY algorithm OPTIONAL  }

    	id-ecPublicKey OBJECT IDENTIFIER ::= {
    		iso(1) member-body(2) us(840) ansi-X9-62(10045) keyType(2) 1 }

    	ECParameters ::= CHOICE {
    		namedCurve         OBJECT IDENTIFIER,
    		implicitCurve      NULL,
    		specifiedCurve     SpecifiedECDomain }

Returns:

the subjectPublicKey TLV structure

### createRSASubjectPublicKeyInfo

    <static> ASN1 createRSASubjectPublicKeyInfo(publicKey)

Creates the RSA Public Key as subjectPublicKeyInfo TLV structure object.

The structure is defined as:

    	SubjectPublicKeyInfo  ::=  SEQUENCE  {
    		algorithm            AlgorithmIdentifier,
    		subjectPublicKey     BIT STRING  }

    	AlgorithmIdentifier  ::=  SEQUENCE  {
    		algorithm               OBJECT IDENTIFIER,
    		parameters              ANY DEFINED BY algorithm OPTIONAL  }

    	pkcs-1 OBJECT IDENTIFIER ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) 1 }

    	rsaEncryption OBJECT IDENTIFIER ::=  { pkcs-1 1}

    	RSAPublicKey ::= SEQUENCE {
    		modulus            INTEGER,    -- n
    		publicExponent     INTEGER  }  -- e

Returns:

the subjectPublicKey TLV structure

### dtoUTC

    <static> String dtoUTC(<Date> d)

Convert date and time to UTC string with format YYMMDDHHMMSSZ.

Parameters:

`d` - the date object.

Returns:

the date/time string.

### encodeName

    <static> ASN1 encodeName(<Object> name)

Gets the dn as TLV object

This function support two format for names

      var issuer = { C:"UT", O:"ACME Corporation", CN:"Test-CA" };
     or
      var issuer = [ { C:"UT"}, { O:"ACME Corporation" }, { CN:"Test-CA"} ];

It supports the following RDNs:

- C - country
- O - organization
- OU - organizational unit
- S - state or province
- L - locality
- T - title
- G - given name
- SN - surname
- CN - common name
- SERIALNUMBER - serial number

The first format sorts the RDS in the sequence C,O,OU,S,L,T,G,SN,CN,SERIALNUMBER

Parameters:

`name` - the name object

Returns:

the RDNSequence

### makeRDN

    <static> Object makeRDN(<String> name, <String> oid, <ASN1> value)

Creates a relative distinguished name component.

The structure is defined as:

    	RelativeDistinguishedName ::=
    		SET SIZE (1..MAX) OF AttributeTypeAndValue

    	AttributeTypeAndValue ::= SEQUENCE {
    		type     AttributeType,
    		value    AttributeValue }

    	AttributeType ::= OBJECT IDENTIFIER

    	AttributeValue ::= ANY -- DEFINED BY AttributeType

    	DirectoryString ::= CHOICE {
    		teletexString           TeletexString (SIZE (1..MAX)),
    		printableString         PrintableString (SIZE (1..MAX)),
    		universalString         UniversalString (SIZE (1..MAX)),
    		utf8String              UTF8String (SIZE (1..MAX)),
    		bmpString               BMPString (SIZE (1..MAX)) }

Parameters:

`name` - the components name

`oid` - the oid for the RDN

`value` - the value object

Returns:

the

### readFileFromDisk

    <static> ByteString readFileFromDisk(<String> filename)

Loads a binary file from disk

Parameters:

`filename` - the fully qualified file name

Returns:

the binary content

### test

    <static> void test()

### writeFileToDisk

    <static> void writeFileToDisk(<String> filename, <ByteString> content)

Writes a byte string object to file

The filename is mapped to the workspace location.

Parameters:

`filename` - the fully qualified name of the file

`content` - the content to write

Overview | File | Class | Tree | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Documentation generated by JSDoc on Fri Oct 24 18:16:45 2025