Git Product home page Git Product logo

Comments (7)

AlexMAS avatar AlexMAS commented on August 22, 2024 1

Здравствуйте!

Постараюсь добавить в ближайшее время. Пока не вижу сложности в этом.

from gostcryptography.

CrazyB0y avatar CrazyB0y commented on August 22, 2024 1

Например, выполнить шифрование XML сессионным ключом

Но вместо Gost_28147_89_SymmetricAlgorithm использовать условный Gost_34_12_2018_SymmetricAlgorithm

    var publicKeyAlgorithm = (GostAsymmetricAlgorithm)certificate.GetPublicKeyAlgorithm();
    var sessionKey = new Gost_28147_89_SymmetricAlgorithm(publicKeyAlgorithm.ProviderType);
    
    elementEncryptedData.EncryptionMethod = new EncryptionMethod(sessionKey.AlgorithmName);
    
    var encryptedXml = new GostEncryptedXml();
    var xmlBytes = Encoding.UTF8.GetBytes(inputXmlDoc.OuterXml);
    var encryptedData = encryptedXml.EncryptData(xmlBytes, sessionKey);
    
    elementEncryptedData.CipherData.CipherValue = encryptedData;
    
    var encryptMethod = new EncryptionMethod(publicKeyAlgorithm.KeyExchangeAlgorithm);
    var encryptedSessionKeyData = GostEncryptedXml.EncryptKey(sessionKey, publicKeyAlgorithm);
    var encryptedSessionKey = new EncryptedKey
    {
        CipherData = new CipherData(encryptedSessionKeyData),
        EncryptionMethod = encryptMethod,
    };
    
    encryptedSessionKey.KeyInfo.AddClause(new KeyInfoX509Data(certificate));
    elementEncryptedData.KeyInfo.AddClause(new KeyInfoEncryptedKey(encryptedSessionKey));

Проверить бы ещё работу Pkcs и реализовать необходимые механизмы, если конечно оно не работает сейчас с указанием нужных Oid для шифрования

from gostcryptography.

AlexMAS avatar AlexMAS commented on August 22, 2024

Опишите, пожалуйста, пользовательский сценарий, что именно хотите сделать с использованием этих алгоритмов. Чтобы я смог написать какие-то тесты на нужную функциональность.

from gostcryptography.

AlexMAS avatar AlexMAS commented on August 22, 2024

@CrazyB0y Здравствуйте! Если у вас есть возможность, можете посмотреть функциональность в ветке magma-and-kuznyechik. Примеры тестов с шифрованием XML можно найти тут:

Если всё ОК, опубликую новую версию пакета.

from gostcryptography.

CrazyB0y avatar CrazyB0y commented on August 22, 2024

Доброго вечера

Вернусь с обратной связью через 3-4 дня
Благодарю за быструю реакцию

from gostcryptography.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.