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

## Class PKCS8

    Object
       |
       +--PKCS8

class PKCS8

Defined in pkcs8.js

Field Summary
`<static> Object` | `idEcPublicKey`
`<static> Object` | `PAD`
`<static> Object` | `rsaEncryption`

Constructor Summary
`PKCS8()` Empty constructor

Method Summary
`<static> ByteString` | `convertUnsignedInteger(<ByteString> value)` Removes leading zeros and prepends a single '00' to ByteStrings which have the most significant bit set.
`<static> Key` | `decodeECCKeyFromPKCS8Format(domainParameter, encodedKey)` Decode a given PKCS#8 ECC private key from the given ByteString and create a GP key object
`<static> Key` | `decodeKeyFromPKCS8Format(encodedKey)` Decode a given PKCS#8 private key from the given ByteString and create a GP key object
`<static> Key` | `decodeRSAKeyFromPKCS8Format(<ASN1> algparam, <ASN1> privateKey)` Decode a given PKCS#8 RSA private key from the given ByteString and create a GP key object
`<static> Object` | `decodeUncompressedECPoint(uncompressedPoint)` Convert uncompressed format to x and y coordinates
`<static> ByteString` | `encodeECCKeyUsingPKCS8Format(privateKey)` Encode a given GP ECC private key as specified by the PKCS#8 format
`<static> ByteString` | `encodeKeyUsingPKCS8Format(privateKey, publicKey)` Encode a given GP private key as specified by the PKCS#8 format
`<static> ByteString` | `encodeRSAKey(<Key> privateKey, publicKey)` Encode RSA private key as defined in PKCS#1
`<static> ByteString` | `encodeRSAKeyUsingPKCS8Format(privateKey, publicKey)` Encode a given GP RSA private key as specified by the PKCS#8 format
`<static> ByteString` | `encodeUncompressedECPoint(<ByteString> x,<ByteString> y)` Convert x/y coordinates to uncompressed format
`<static> ByteString` | `I2O(<ByteString> value, length)` Integer to octet string conversion
`<static> ByteString` | `stripLeadingZeros(<ByteString> value, size)` Strips leading zeros of a ByteString
`<static> void` | `test()` Simple self-test

Field Detail

### idEcPublicKey

    <static> Object idEcPublicKey

### PAD

    <static> Object PAD

### rsaEncryption

    <static> Object rsaEncryption

Constructor Detail

### PKCS8

    PKCS8()

Empty constructor

Method Detail

### 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

### decodeECCKeyFromPKCS8Format

    <static> Key decodeECCKeyFromPKCS8Format(domainParameter, encodedKey)

Decode a given PKCS#8 ECC private key from the given ByteString and create a GP key object For now we only support the decoding of ECC private keys in a prime field

Parameters:

`algparam` - the algorithm parameter from AlgorithmInfo

`privateKey` - the privateKey element from the PKCS#8 structure

Returns:

the GP key object

### decodeKeyFromPKCS8Format

    <static> Key decodeKeyFromPKCS8Format(encodedKey)

Decode a given PKCS#8 private key from the given ByteString and create a GP key object For now we only support the decoding of ECC private keys in a prime field

Parameters:

`the` - private key object in PKCS#8 format

Returns:

the GP key object

### decodeRSAKeyFromPKCS8Format

    <static> Key decodeRSAKeyFromPKCS8Format(<ASN1> algparam, <ASN1> privateKey)

Decode a given PKCS#8 RSA private key from the given ByteString and create a GP key object

Parameters:

`algparam` - the algorithm parameter from AlgorithmInfo

`privateKey` - the privateKey element from the PKCS#8 structure

`the` - private key object in PKCS#8 format

Returns:

the GP key object

### decodeUncompressedECPoint

    <static> Object decodeUncompressedECPoint(uncompressedPoint)

Convert uncompressed format to x and y coordinates

Parameters:

`compressed` - point

Returns:

Object with ByteString properties x and y

### encodeECCKeyUsingPKCS8Format

    <static> ByteString encodeECCKeyUsingPKCS8Format(privateKey)

Encode a given GP ECC private key as specified by the PKCS#8 format

Parameters:

`the` - private key object that should be encoded

Returns:

the encoded PKCS#8 private key

### encodeKeyUsingPKCS8Format

    <static> ByteString encodeKeyUsingPKCS8Format(privateKey, publicKey)

Encode a given GP private key as specified by the PKCS#8 format For now we only support the encoding of ECC private keys in a prime field

Parameters:

`the` - private key object that should be encoded

Returns:

the encoded PKCS#8 private key

### encodeRSAKey

    <static> ByteString encodeRSAKey(<Key> privateKey, publicKey)

Encode RSA private key as defined in PKCS#1 RSAPrivateKey ::= SEQUENCE { version Version, modulus INTEGER, -- n publicExponent INTEGER, -- e privateExponent INTEGER, -- d prime1 INTEGER, -- p prime2 INTEGER, -- q exponent1 INTEGER, -- d mod (p-1) exponent2 INTEGER, -- d mod (q-1) coefficient INTEGER, -- (inverse of q) mod p otherPrimeInfos OtherPrimeInfos OPTIONAL }

Parameters:

`privateKey` - the private RSA key in CRT format

Returns:

the encoded RSA key

### encodeRSAKeyUsingPKCS8Format

    <static> ByteString encodeRSAKeyUsingPKCS8Format(privateKey, publicKey)

Encode a given GP RSA private key as specified by the PKCS#8 format

Parameters:

`the` - private key object that should be encoded

Returns:

the encoded PKCS#8 private key

### encodeUncompressedECPoint

    <static> ByteString encodeUncompressedECPoint(<ByteString> x,<ByteString> y)

Convert x/y coordinates to uncompressed format

Parameters:

`x` - the x coordinate

`y` - the y coordinate

Returns:

ByteString containing compressed format

### I2O

    <static> ByteString I2O(<ByteString> value, length)

Integer to octet string conversion

Parameters:

`value` - the encoded integer value

`the` - number of digits

Returns:

the truncated or padded result

### stripLeadingZeros

    <static> ByteString stripLeadingZeros(<ByteString> value, size)

Strips leading zeros of a ByteString

Parameters:

`value` - the ByteString value

Returns:

the stripped ByteString object, may be an empty ByteString

### test

    <static> void test()

Simple self-test

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 Thu Jun 25 17:01:35 2026