rudonick / crypto Goto Github PK
View Code? Open in Web Editor NEWWebCrypto GOST
WebCrypto GOST
Будет ли модуль для Node.js доступный в NPM ?
Hello,
I am getting 'Invalid key MAC' error message when exporting SignalCom GOST 2012 key on this page http://gostcrypto.com/demo-sc-keys.html
Hi,
I'm trying to sign string using gostcrypt, but it does not work as expected. Here is an example:
const SIGNATURE = gostEngine.getGostSign({
name: 'GOST R 34.10',
version: 2001
});
const KEY = gostCoding.PEM.decode(signingKey.exchangeKey);
let res = SIGNATURE.sign(KEY, new Buffer(textString));
The problem is that that I can't verify the signature using CryptoPro tools.
They private key is taken from the CryptoPro container and CryptoPro builds correct signature for the same text.
csptest -keyset -sign GOST -in text -out text.bin -container '\\.\HDIMAGE\TEST' -keytype exchange
Is there anything I can tweak in the code to make valid (recognizable) signature?
While examining demo page I found inconsistencies between ASN1 and JSON data representation.
Looks like two first bytes of .privateKey in JSON representation belong to ASN1 header and is not a part of the key.
Method gostCrypto.asn1.PrivateKeyInfo.decode should be fixed.
Do not work "exportPrivateKey()" on page http://gostcrypto.com/demo-cp-keys.html for ГОСТ 2012
error on line:
if (!equalBuffers(hmac, self.header.hmacKeyContainerContent))
throw new Error("Container is not valid.");
key from https://testca2012.cryptopro.ru/ui/
le-d3bb8.000.zip password qwerty
on pressing "Export Key and Certificate"
While examining demo page I found inconsistencies between ASN1 and JSON data representation.
Looks like two first bytes of .privateKey
in JSON representation belong to ASN1 header and is not a part of the key.
Method gostCrypto.asn1.PrivateKeyInfo.decode
should be fixed.
Hlo
Создал здесь https://www.cryptopro.ru/certsrv/certrqma.asp сертификат 34.10-2012 CSP
Установил его.
Протестировал на C# через CryptoPro.NET, работает.
Попытался на демо http://gostcrypto.com/demo-cp-keys.html
импортировать pfx файл с приватным ключом, выдает ошибку "Algorithm not supported".
В ASN.1 Data вижу вот такую строку OBJECT IDENTIFIER pbeUnknownGost (1.2.840.113549.1.12.1.80)
Bbbb
При попытке создать новый ключ из Мастер ключа с помощью 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 инициализироваться:
Line 319 in a8caf28
Прошу исправить такой досадный баг
From the processCTR89
function:
syn[0] = (syn[0] + 0x1010101) & 0xffffffff;
syn[1] = signed(unsigned((syn[1] + 0x1010104) & 0xffffffff) % 0xffffffff);
It seems that you have an error while doing with the C2 (0x01010104) constant here. GOST says that:
a + b (mod 2^32) ::= { a + b, if (a + b) < 2^32; a + b - 2^32, elsewhere }
a + b (mod 2^32 - 1) ::= { a + b, if (a + b) < 2^32; a + b - 2^32 + 1, elsewhere }
So, the valid code may looks like that:
syn[0] = (syn[0] + 0x1010101) & 0xffffffff;
tmp = syn[1] + 0x1010104;
syn[1] = (tmp & 0xffffffff) + (tmp >> 32);
Do not load the public certificate CryptoPro. I want to make signature CMS.
http://gostcrypto.com/pki-sign.html
Why is it not working?
-----BEGIN CERTIFICATE-----
MIIHFjC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IgKNCy0LXRgNGB0LjRjyAzLjYpDFMi0KPQ
tNC+0YHRgtC+0LLQtdGA0Y/RjtGJ0LjQuSDRhtC10L3RgtGAICLQmtGA0LjQv9GC
0L7Qn9GA0L4g0KPQpiIg0LLQtdGA0YHQuNC4IDEuNQwl4oSWINCh0KQvMTI0LTIy
Mzgg0L7RgiAwNC4xMC4yMDEzINCzLgwl4oSWINCh0KQvMTI4LTIzNTIg0L7RgiAx
NS4wNC4yMDE0INCzLjAIBgYqhQMCAgMDQQAaiJ8c6cMj4OcmFYLeyIUitqH1J9Ic
OETy8R1L83saJlIXpt9gKtGfgcFZEfRaIGCYkxBAwJcv9KTLHhbG/Vm4
-----END CERTIFICATE-----
Скажите пожалуйста, будет ли добавлена поддержка нового стандарта ГОСТ Р 34.12-2015 в сущносте GostSecurity?
Ссылка: http://gostcrypto.com/doc/GostSecurity.html
На сегодняшний день она работает с ГОСТ 28147-89.
Здравствуйте, обнаружил битую ссылку в документации: GostRandom.
Здравствуйте. Кажется обнаружил ошибку работы библиотеки.
Суть ошибки: Не выполняется условие H(M) = H(D(E(M)))
, где M
- сообщение; H
- хэш-функция ГОСТ Р 34.11-2012; E/D
- шифрование/дешифрования по алгоритму ГОСТ Р 34.12.2015 CBC.
В режиме OFB, условие выполняется!
Ниже приведен снимок экрана, и программный стенд на котором можно посмотреть - NetBeans.
AcoCryptJS.zip
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.