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 oldKeyPasswordstring Old key password newKeyPasswordstring 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 formatstring 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 reqFormatedData | GostASN1.CertificationRequest The request templates keyPasswordKey | CryptoOperationData | string The secret key or password for decryption keyAlgorithmAlgorithmIdentifier | 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 secondaryboolean 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 keyPasswordstring The password for decryption secondaryboolean 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 keyPasswordstring Rhe password for decryption secondaryboolean 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 certificateFormatedData | GostCert.X509 The certificate secondaryboolean True for set secondary certificate daysnumber 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 namestring Container name - Source:
-
setKey(keyInfo, keyPassword, secondary, days) → {Promise}
-
Sets and encrypt the private key info
Parameters:
Name Type Description keyInfoFormatedData | GostKeys.PKCS8 The private key info keyPasswordstring The assword for encryption secondaryboolean True for set secondary key daysnumber 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 privateKeyKey The private key keyPasswordstring The secret key encryption secondaryboolean True for set secondary key daysnumber 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 keyPasswordstring the secret key or password for decryption - Source:
Returns:
Promise to return self object after verify- Type
- Promise