WebCrypto GOST Class: SubtleCrypto

SubtleCrypto

Constructor

new SubtleCrypto()

The SubtleCrypto class provides low-level cryptographic primitives and algorithms. WebCrypto API reference http://www.w3.org/TR/WebCryptoAPI/#subtlecrypto-interface
Source:

Methods

decrypt(algorithm, key, data) → {Promise}

The decrypt method returns a new Promise object that will decrypt data using the specified algorithm identifier with the supplied Key. WebCrypto API reference http://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-decrypt

Supported algorithm names:
  • GOST 28147-ECB "prostaya zamena" (ECB) mode (default)
  • GOST 28147-CFB "gammirovanie s obratnoj svyaziyu po shifrotekstu" (CFB) mode
  • GOST 28147-OFB "gammirovanie s obratnoj svyaziyu po vyhodu" (OFB) mode
  • GOST 28147-CTR "gammirovanie" (counter) mode
  • GOST 28147-CBC Cipher-Block-Chaining (CBC) mode
  • GOST R 34.12-ECB "prostaya zamena" (ECB) mode (default)
  • GOST R 34.12-CFB "gammirovanie s obratnoj svyaziyu po shifrotekstu" (CFB) mode
  • GOST R 34.12-OFB "gammirovanie s obratnoj svyaziyu po vyhodu" (OFB) mode
  • GOST R 34.12-CTR "gammirovanie" (counter) mode
  • GOST R 34.12-CBC Cipher-Block-Chaining (CBC) mode
For additional modes see GostCipher
Parameters:
Name Type Description
algorithm AlgorithmIdentifier Algorithm identifier
key Key Key object
data CryptoOperationData Operation data
Source:
Returns:
Promise that resolves with CryptoOperationData
Type
Promise

deriveBits(algorithm, baseKey, length) → {Promise}

The deriveBits method returns length bits on baseKey using the specified algorithm identifier. WebCrypto API reference http://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-deriveBits

Supported algorithm names:
  • GOST R 34.10-DH ECDH Key Agreement mode
  • GOST R 34.11-KDF Key for Derivation Algorithm
  • GOST R 34.11-PBKDF2 Password Based Key for Derivation Algorithm
  • GOST R 34.11-PFXKDF PFX Key for Derivation Algorithm
  • GOST R 34.11-CPKDF Password Based Key for CryptoPro Derivation Algorithm
  • SHA-PBKDF2 Password Based Key for Derivation Algorithm
  • SHA-PFXKDF PFX Key for Derivation Algorithm
For additional modes see GostSign and GostDigest
Parameters:
Name Type Description
algorithm AlgorithmIdentifier Algorithm identifier
baseKey Key Derivation key object
length number Length bits
Source:
Returns:
Promise that resolves with CryptoOperationData
Type
Promise

deriveKey(algorithm, baseKey, derivedKeyType, extractable, keyUsages) → {Promise}

The deriveKey method returns a new Promise object that will key(s) using the specified algorithm identifier. Key can be used in according with KeyUsage sequence. The recognized key usage values are "encrypt", "decrypt", "sign", "verify", "deriveKey", "deriveBits", "wrapKey" and "unwrapKey". WebCrypto API reference http://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-deriveKey

Supported algorithm names:
  • GOST R 34.10-DH ECDH Key Agreement mode
  • GOST R 34.11-KDF Key for Derivation Algorithm
  • GOST R 34.11-PBKDF2 Password Based Key for Derivation Algorithm
  • GOST R 34.11-PFXKDF PFX Key for Derivation Algorithm
  • GOST R 34.11-CPKDF Password Based Key for CryptoPro Derivation Algorithm
  • SHA-PBKDF2 Password Based Key for Derivation Algorithm
  • SHA-PFXKDF PFX Key for Derivation Algorithm
For additional modes see GostSign and GostDigest
Parameters:
Name Type Description
algorithm AlgorithmIdentifier Algorithm identifier
baseKey Key Derivation key object
derivedKeyType AlgorithmIdentifier Derived key algorithm identifier
extractable boolean Whether or not the raw keying material may be exported by the application
keyUsages KeyUsages Key usage array: type of operation that may be performed using a key
Source:
Returns:
Promise that resolves with Key
Type
Promise

digest(algorithm, data) → {Promise}

The digest method returns a new Promise object that will digest data using the specified algorithm identifier. WebCrypto API reference http://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-digest

Supported algorithm names:
  • GOST R 34.11-94 Old-Style GOST Hash
  • GOST R 34.11 GOST Streebog Hash
  • SHA SHA Hash
For additional modes see GostDigest
Parameters:
Name Type Description
algorithm AlgorithmIdentifier Algorithm identifier
data CryptoOperationData Operation data
Source:
Returns:
Promise that resolves with CryptoOperationData
Type
Promise

encrypt(algorithm, key, data) → {Promise}

The encrypt method returns a new Promise object that will encrypt data using the specified algorithm identifier with the supplied Key. WebCrypto API reference http://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-encrypt

Supported algorithm names:
  • GOST 28147-ECB "prostaya zamena" (ECB) mode (default)
  • GOST 28147-CFB "gammirovanie s obratnoj svyaziyu po shifrotekstu" (CFB) mode
  • GOST 28147-OFB "gammirovanie s obratnoj svyaziyu po vyhodu" (OFB) mode
  • GOST 28147-CTR "gammirovanie" (counter) mode
  • GOST 28147-CBC Cipher-Block-Chaining (CBC) mode
  • GOST R 34.12-ECB "prostaya zamena" (ECB) mode (default)
  • GOST R 34.12-CFB "gammirovanie s obratnoj svyaziyu po shifrotekstu" (CFB) mode
  • GOST R 34.12-OFB "gammirovanie s obratnoj svyaziyu po vyhodu" (OFB) mode
  • GOST R 34.12-CTR "gammirovanie" (counter) mode
  • GOST R 34.12-CBC Cipher-Block-Chaining (CBC) mode
For more information see GostCipher
Parameters:
Name Type Description
algorithm AlgorithmIdentifier Algorithm identifier
key Key Key object
data CryptoOperationData Operation data
Source:
Returns:
Promise that resolves with CryptoOperationData
Type
Promise

exportKey(format, key) → {Promise}

The exportKey method returns a new Promise object that will key data in defined format.

The suppored key format values are:
  • 'raw' - An unformatted sequence of bytes. Intended for secret keys.
  • 'pkcs8' - The DER encoding of the PrivateKeyInfo structure from RFC 5208.
  • 'spki' - The DER encoding of the SubjectPublicKeyInfo structure from RFC 5280.
WebCrypto API reference http://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-exportKey

Supported algorithm names:
  • GOST R 34.10-94 GOST Private and Public keys
  • GOST R 34.10 ECGOST Private and Public keys
  • GOST 28147 Key for encryption GOST 28147 modes
  • GOST 28147-KW Key for key wrapping GOST 28147 modes
  • GOST R 34.12 Key for encryption GOST R 34.12 modes
  • GOST R 34.12-KW Key for key wrapping GOST R 34.12 modes
  • GOST R 34.11-KDF Key for Derivation Algorithm
  • GOST R 34.11-PBKDF2 Import Password for Key for Derivation Algorithm
  • GOST R 34.11-PFXKDF Import PFX Key for Derivation Algorithm
  • GOST R 34.11-CPKDF Import Password Key for CryptoPro Derivation Algorithm
  • SHA-PBKDF2 Import Password for Key for Derivation Algorithm
  • SHA-PFXKDF Import PFX Key for Derivation Algorithm
For additional modes see GostSign, GostDigest and GostCipher
Parameters:
Name Type Description
format KeyFormat Format specifies a serialization format for a key
key Key Key object
Source:
Returns:
Promise that resolves with CryptoOperationData
Type
Promise

generateKey(algorithm, extractable, keyUsages) → {Promise}

The generateKey method returns a new Promise object that will key(s) using the specified algorithm identifier. Key can be used in according with KeyUsages sequence. The recognized key usage values are "encrypt", "decrypt", "sign", "verify", "deriveKey", "deriveBits", "wrapKey" and "unwrapKey". WebCrypto API reference http://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-generateKey

Supported algorithm names:
  • GOST R 34.10 ECGOST Key Pairs
  • GOST 28147 Key for encryption GOST 28147 modes
  • GOST 28147-KW Key for wrapping GOST 28147 modes
  • GOST R 34.12 Key for encryption GOST R 34.12 modes
  • GOST R 34.12-KW Key for wrapping GOST R 34.12 modes
  • GOST R 34.11-KDF Key for Derivation Algorithm
For additional modes see GostSign, GostDigest and GostCipher
Note: Generation key for GOST R 34.10-94 not supported.
Parameters:
Name Type Description
algorithm AlgorithmIdentifier Key algorithm identifier
extractable boolean Whether or not the raw keying material may be exported by the application
keyUsages KeyUsages Key usage array: type of operation that may be performed using a key
Source:
Returns:
Promise that resolves with Key or KeyPair in according to key algorithm
Type
Promise

importKey(format, keyData, algorithm, extractable, keyUsages) → {Promise}

The importKey method returns a new Promise object that will key(s) using the specified algorithm identifier. Key can be used in according with KeyUsage sequence. The recognized key usage values are "encrypt", "decrypt", "sign", "verify", "deriveKey", "deriveBits", "wrapKey" and "unwrapKey".

Parameter keyData contains data in defined format. The suppored key format values are:
  • 'raw' - An unformatted sequence of bytes. Intended for secret keys.
  • 'pkcs8' - The DER encoding of the PrivateKeyInfo structure from RFC 5208.
  • 'spki' - The DER encoding of the SubjectPublicKeyInfo structure from RFC 5280.
WebCrypto API reference http://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-importKey

Supported algorithm names:
  • GOST R 34.10-94 GOST Private and Public keys
  • GOST R 34.10 ECGOST Private and Public keys
  • GOST 28147 Key for encryption GOST 28147 modes
  • GOST 28147-KW Key for key wrapping GOST 28147 modes
  • GOST R 34.12 Key for encryption GOST 34.12 modes
  • GOST R 34.12-KW Key for key wrapping GOST 34.12 modes
  • GOST R 34.11-KDF Key for Derivation Algorithm
For additional modes see GostSign, GostDigest and GostCipher
Parameters:
Name Type Description
format KeyFormat Key format Format specifies a serialization format for a key
keyData CryptoOperationData
algorithm AlgorithmIdentifier Key algorithm identifier
extractable boolean Whether or not the raw keying material may be exported by the application
keyUsages KeyUsages Key usage array: type of operation that may be performed using a key
Source:
Returns:
Promise that resolves with Key
Type
Promise

sign(algorithm, key, data) → {Promise}

The sign method returns a new Promise object that will sign data using the specified algorithm identifier with the supplied Key. WebCrypto API reference http://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-sign

Supported algorithm names:
  • GOST R 34.10-94 GOST Signature
  • GOST R 34.10-94/GOST R 34.11-94 GOST Signature with Hash
  • GOST R 34.10 ECGOST Signature
  • GOST R 34.10/GOST R 34.11-94 ECGOST Signature with Old-Style Hash
  • GOST R 34.10/GOST R 34.11 ECGOST Signature with Streebog Hash
  • GOST 28147-MAC MAC base on GOST 28147
  • GOST R 34.12-MAC MAC base on GOST R 43.12
  • GOST R 34.11-HMAC HMAC base on GOST 34.11
  • SHA-HMAC HMAC base on SHA
For additional modes see GostSign, GostDigest and GostCipher
Parameters:
Name Type Description
algorithm AlgorithmIdentifier Algorithm identifier
key Key Key object
data CryptoOperationData Operation data
Source:
Returns:
Promise that resolves with CryptoOperationData
Type
Promise

unwrapKey(format, wrappedKey, unwrappingKey, unwrapAlgorithm, unwrappedKeyAlgorithm, extractable, keyUsages) → {Promise}

The unwrapKey method returns a new Promise object that will unwrapped key(s). WebCrypto API reference http://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-unwrapKey

Supported algorithm names:
  • GOST 28147-KW Key Wrapping GOST 28147 modes
  • GOST R 34.12-KW Key Wrapping GOST R 34.12 modes
  • GOST 28147-MASK Key Mask GOST 28147 modes
  • GOST R 34.12-MASK Key Mask GOST R 34.12 modes
  • GOST R 34.10-MASK Key Mask GOST R 34.10 modes
For additional modes see GostCipher
Parameters:
Name Type Description
format KeyFormat Format specifies a serialization format for a key. Now suppored only 'raw' key format.
wrappedKey CryptoOperationData Wrapped key data
unwrappingKey Key Unwrapping key object
unwrapAlgorithm AlgorithmIdentifier Algorithm identifier
unwrappedKeyAlgorithm AlgorithmIdentifier Key algorithm identifier
extractable boolean Whether or not the raw keying material may be exported by the application
keyUsages KeyUsages Key usage array: type of operation that may be performed using a key
Source:
Returns:
Promise that resolves with Key
Type
Promise

verify(algorithm, key, signature, data) → {Promise}

The verify method returns a new Promise object that will verify data using the specified algorithm identifier with the supplied Key. WebCrypto API reference http://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-verify

Supported algorithm names:
  • GOST R 34.10-94 GOST Signature
  • GOST R 34.10-94/GOST R 34.11-94 GOST Signature with Hash
  • GOST R 34.10 ECGOST Signature
  • GOST R 34.10/GOST R 34.11-94 ECGOST Signature with Old-Style Hash
  • GOST R 34.10/GOST R 34.11 ECGOST Signature with Streebog Hash
  • GOST 28147-MAC MAC base on GOST 28147
  • GOST R 34.12-MAC MAC base on GOST R 34.12
  • GOST R 34.11-HMAC HMAC base on GOST 34.11
  • SHA-HMAC HMAC base on SHA
For additional modes see GostSign, GostDigest and GostCipher
Parameters:
Name Type Description
algorithm AlgorithmIdentifier Algorithm identifier
key Key Key object
signature CryptoOperationData Signature data
data CryptoOperationData Operation data
Source:
Returns:
Promise that resolves with boolean value of verification result
Type
Promise

wrapKey(format, key, wrappingKey, wrapAlgorithm) → {Promise}

The wrapKey method returns a new Promise object that will wrapped key(s). WebCrypto API reference http://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-wrapKey

Supported algorithm names:
  • GOST 28147-KW Key Wrapping GOST 28147 modes
  • GOST R 34.12-KW Key Wrapping GOST R 34.12 modes
  • GOST 28147-MASK Key Mask GOST 28147 modes
  • GOST R 34.12-MASK Key Mask GOST R 34.12 modes
  • GOST R 34.10-MASK Key Mask GOST R 34.10 modes
For additional modes see GostCipher
Parameters:
Name Type Description
format KeyFormat Format specifies a serialization format for a key. Now suppored only 'raw' key format.
key Key Key object
wrappingKey Key Wrapping key object
wrapAlgorithm AlgorithmIdentifier Algorithm identifier
Source:
Returns:
Promise that resolves with CryptoOperationData
Type
Promise