private static XmlDocument DecryptXmlDocument(XmlDocument encryptedXmlDocument, Gost28147 sharedKey)
        {
            // Создание объекта для дешифрации XML
            var encryptedXml = new GostEncryptedXml(encryptedXmlDocument);

            // Добавление ссылки на общий симметричный ключ
            encryptedXml.AddKeyNameMapping("SharedKey1", sharedKey);

            // Расшифровка зашифрованных элементов документа
            encryptedXml.DecryptDocument();

            return(encryptedXmlDocument);
        }
Ejemplo n.º 2
0
        private static XmlDocument DecryptXmlDocument(XmlDocument encryptedXmlDocument, GostAsymmetricAlgorithm privateKey)
        {
            // Создание объекта для дешифрации XML
            var encryptedXml = new GostEncryptedXml(privateKey.ProviderType, encryptedXmlDocument);

            // Добавление ссылки на приватный асимметричный ключ
            encryptedXml.AddKeyNameMapping("KeyName1", privateKey);

            // Расшифровка зашифрованных элементов документа
            encryptedXml.DecryptDocument();

            return(encryptedXmlDocument);
        }