WebCrypto GOST Class: CryptoProKeyContainer

GostKeys. CryptoProKeyContainer

Constructor

new CryptoProKeyContainer(container)

A class for password-encrypted private keys in CryptoPro container The container file list:
  • header - container header @link GostASN1.GostKeyContainer
  • name - container name @link GostASN1.GostKeyContainerName
  • primary - private keys data @link GostASN1.GostPrivateKeys
  • masks - private key masks @link GostASN1.GostPrivateMasks
  • primary2 - reserve of private keys data @link GostASN1.GostPrivateKeys
  • masks2 - reserve of private key masks @link GostASN1.GostPrivateMasks
Parameters:
Name Type Description
container Object
Source:

Methods

changePassword(oldKeyPassword, newKeyPassword) → {Promise}

Change key password
Parameters:
Name Type Description
oldKeyPassword string Old key password
newKeyPassword string New key password
Source:
Returns:
Promise to return self object after change password
Type
Promise

encode(format) → {Object}

Encode key container
Parameters:
Name Type Description
format string Encode format 'DER', 'CER', 'PEM'
Source:
Returns:
container Object contains encoded files
Type
Object

generate(req, keyPassword, keyAlgorithm) → {Promise}

Generate private key, certificate and return certification request
Parameters:
Name Type Description
req FormatedData | GostASN1.CertificationRequest The request templates
keyPassword Key | CryptoOperationData | string The secret key or password for decryption
keyAlgorithm AlgorithmIdentifier | string The name of provider or algorithm
Source:
Returns:
Promise to return GostCert.Request
Type
Promise

getCertificate(secondary) → {Promise}

Get the certificate from the key container
Parameters:
Name Type Description
secondary boolean True for set secondary certificate
Source:
Returns:
Promise to return GostCert.X509
Type
Promise

getContainerName() → {string}

Get the container name
Source:
Returns:
Container name
Type
string

getKey(keyPassword, secondary) → {Promise}

Get the private key info
Parameters:
Name Type Description
keyPassword string The password for decryption
secondary boolean True if required secondary key
Source:
Returns:
Promise to return GostKeys.PKCS8
Type
Promise

getPrivateKey(keyPassword, secondary) → {Promise}

Get the private key
Parameters:
Name Type Description
keyPassword string Rhe password for decryption
secondary boolean True if required secondary key
Source:
Returns:
Promise to return the Key
Type
Promise

setCertificate(certificate, secondary, days) → {Promise}

Set the certificate to the key container
Parameters:
Name Type Description
certificate FormatedData | GostCert.X509 The certificate
secondary boolean True for set secondary certificate
days number Validity days. Default 7305 days (20 years)
Source:
Returns:
Promise to return self object after set certificate
Type
Promise

setContainerName(name)

Set the container name
Parameters:
Name Type Description
name string Container name
Source:

setKey(keyInfo, keyPassword, secondary, days) → {Promise}

Sets and encrypt the private key info
Parameters:
Name Type Description
keyInfo FormatedData | GostKeys.PKCS8 The private key info
keyPassword string The assword for encryption
secondary boolean True for set secondary key
days number Validity days. Default 7305 days (20 years)
Source:
Returns:
Promise to return self object after set key
Type
Promise

setPrivateKey(privateKey, keyPassword, secondary, days) → {Promise}

Set the private key
Parameters:
Name Type Description
privateKey Key The private key
keyPassword string The secret key encryption
secondary boolean True for set secondary key
days number Validity days. Default 7305 days (20 years)
Source:
Returns:
Promise to return self object after set key
Type
Promise

verify(keyPassword) → {Promise}

Verify key container with password
Parameters:
Name Type Description
keyPassword string the secret key or password for decryption
Source:
Returns:
Promise to return self object after verify
Type
Promise