Skip to content

Ошибка в функции нормализации алгоритмов #22

@W0rthLes

Description

@W0rthLes

При попытке создать новый ключ из Мастер ключа с помощью gostCrypto.subtle.deriveKey() столкнулся с ошибкой.
Сначала импортируется Мастер ключ с помощью importKey:

const MasterKeyImported = await new gostCrypto.subtle.importKey(
        'raw',
        master_key,
        {
            name: 'GOST R 34.11',
            mode: 'KDF',
            label: new ArrayBuffer(0),
            context: new ArrayBuffer(0)},
        true,
        ['deriveKey']
    );

После чего произовдится формирование нового ключа:

const newKey = await new gostCrypto.subtle.deriveKey(
        {
            name: 'GOST R 34.11',
            mode: 'KDF',
            context: new ArrayBuffer(0)
        },
        MasterKeyImported,
        {
            name: 'GOST R 34.12',
            version: 2015,
            length: 256,
            block: 'CBC',
            padding: 'PKCS7'
        },
        true,
        ['encrypt', 'decrypt']
    )

В процессе работы программы метод GostDigest.deriveBitsKDF выдает ошибку в функции buffer.
Сам экземпляр класса GostDigest выглядит следующим образом:

GostDigest {
  name: 'GOST R 34.11-12-256-KDF/CP',
  procreator: 'CP',
  bitLength: 256,
  digest: [Function (anonymous)],
  keySize: 32,
  deriveKey: [Function: deriveKey],
  deriveBits: [Function: deriveBitsKDF],
  label: ArrayBuffer { [Uint8Contents]: <>, byteLength: 0 },
  context: undefined
}

Неопределенный тип параметра context указывает на ошибку при сборке экземпляра. Дебаг мод показал, что в функции normalize содержится опечатка, которая не дает параметру context инициализироваться:

algorithm.contex && (na.context = algorithm.contex);

Прошу исправить такой досадный баг

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions