Получение хэша от строки по гост 94

Материал из Wiki МИАЦ ВО
Перейти к навигации Перейти к поиску
            string signedInfo22 = "<SOAP-ENV:Body xmlns:SOAP-ENV=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\" wsu:Id=\"BODY\"><PRPA_IN201301RU02 xmlns=\"urn:hl7-org:v3\" ITSVersion=\"XML_1.0\"><id extension=\"0\" root=\"1.2.643.5.1.13.3.25.35.11\"></id><creationTime value=\"20150209172931\"></creationTime><interactionId extension=\"PRPA_IN201301RU02\" root=\"1.2.643.5.1.13.2.7.3\"></interactionId><processingCode code=\"P\"></processingCode><processingModeCode code=\"T\"></processingModeCode><acceptAckCode code=\"AL\"></acceptAckCode><receiver typeCode=\"RCV\"><device classCode=\"DEV\" determinerCode=\"INSTANCE\"><id root=\"d5a0f9c0-5db4-11e3-949a-0800200c9a66\"></id><asAgent classCode=\"ASSIGNED\"><representedOrganization classCode=\"ORG\" determinerCode=\"INSTANCE\"><id root=\"1.2.643.5.1.13.2.7.3\"></id><name>ИЭМК</name></representedOrganization></asAgent></device></receiver><sender typeCode=\"SND\"><device classCode=\"DEV\" determinerCode=\"INSTANCE\"><id root=\"d84c8524-d53e-43c6-973c-5076646731d8\"></id><name>МИС Вологодской области \"Статистика и счета ЛПУ\"</name><asAgent classCode=\"ASSIGNED\"><representedOrganization classCode=\"ORG\" determinerCode=\"INSTANCE\"><id root=\"1.2.643.5.1.13.3.25.35.11\"></id><name>БУЗ ВО ВОЛОГОДСКАЯ ГОРОДСКАЯ ПОЛИКЛИНИКА 3</name></representedOrganization></asAgent></device></sender><controlActProcess classCode=\"CACT\" moodCode=\"EVN\"><subject typeCode=\"SUBJ\"><registrationEvent classCode=\"REG\" moodCode=\"EVN\"><id nullFlavor=\"NA\"></id><statusCode code=\"active\"></statusCode><subject1 typeCode=\"SBJ\"><patient classCode=\"PAT\"><id extension=\"3655\" root=\"1.2.643.5.1.13.3.25.35.11\"></id><statusCode code=\"active\"></statusCode><patientPerson><name><family>XXXXXX</family><given>YYYYYYYY</given><given>ZZZZZZZZZZZZZZ</given></name><administrativeGenderCode code=\"2\" codeSystem=\"1.2.643.5.1.13.2.1.1.156\"></administrativeGenderCode><birthTime value=\"19590928\"></birthTime><addr><streetAddressLine>г. ВОЛОГДА, ул. FFFFFFFFFF кв.31</streetAddressLine><city>ВОЛОГДА</city><state>ВОЛОГОДСКАЯ</state><country>Российская Федерация</country></addr><asMember classCode=\"MBR\"><group classCode=\"PUB\"><code code=\"5\" codeSystem=\"1.2.643.5.1.13.2.1.1.366\" displayName=\"Неработающий\"></code></group></asMember><asMember classCode=\"MBR\"><group classCode=\"PUB\"><code code=\"2\" codeSystem=\"1.2.643.5.1.13.2.1.1.358\" displayName=\"инвалиды войны\"></code></group></asMember><asOtherIDs classCode=\"IDENT\"><documentType code=\"3\" codeSystem=\"1.2.643.5.1.13.2.7.1.62\"></documentType><documentNumber number=\"06377932094\"></documentNumber><scopingOrganization classCode=\"ORG\" determinerCode=\"INSTANCE\"><id nullFlavor=\"NI\"></id></scopingOrganization></asOtherIDs><asOtherIDs classCode=\"HLD\"><documentType code=\"1\" codeSystem=\"1.2.643.5.1.13.2.7.1.62\"></documentType><documentNumber number=\"3550040871001818\"></documentNumber><effectiveTime value=\"20120416\"></effectiveTime><scopingOrganization classCode=\"ORG\" determinerCode=\"INSTANCE\"><id extension=\"35003\" root=\"1.2.643.5.1.13.2.1.1.635\"></id><name>ОАО\"СТРАХОВАЯ КОМПАНИЯ \"СОГАЗ-МЕД\"</name></scopingOrganization></asOtherIDs><asOtherIDs classCode=\"IDENT\"><documentType code=\"5\" codeSystem=\"1.2.643.5.1.13.2.7.1.62\"><qualifier><name code=\"14\" codeSystem=\"1.2.643.5.1.13.2.1.1.498\" codeSystemName=\"Классификатор документов, удостоверяющих личность гражданина Российской Федерации\" displayName=\"Паспорт гражданина РФ\"></name></qualifier></documentType><documentNumber number=\"1909614992\"></documentNumber><scopingOrganization classCode=\"ORG\" determinerCode=\"INSTANCE\"><id nullFlavor=\"NI\"></id><name>УФМС Г.ВОЛОГДА</name></scopingOrganization></asOtherIDs><birthPlace><addr><city>Вологда</city><state>Российская Федерация</state></addr></birthPlace></patientPerson><providerOrganization classCode=\"ORG\" determinerCode=\"INSTANCE\"><id root=\"1.2.643.5.1.13.3.25.35.11\"></id><name>БУЗ ВО ВОЛОГОДСКАЯ ГОРОДСКАЯ ПОЛИКЛИНИКА 3</name><contactParty classCode=\"CON\"><telecom value=\"+8(8202)74-13-06\"></telecom></contactParty></providerOrganization></patient></subject1><custodian typeCode=\"CST\"><assignedEntity classCode=\"ASSIGNED\"><id root=\"1.2.643.5.1.13.3.25.35.11\"></id><assignedOrganization classCode=\"ORG\" determinerCode=\"INSTANCE\"><name>БУЗ ВО ВОЛОГОДСКАЯ ГОРОДСКАЯ ПОЛИКЛИНИКА 3</name></assignedOrganization></assignedEntity></custodian></registrationEvent></subject></controlActProcess></PRPA_IN201301RU02></SOAP-ENV:Body>";
            HashAlgorithm myhash1 = HashAlgorithm.Create("Gost3411");
            byte[] hashResult = myhash1.ComputeHash(Encoding.UTF8.GetBytes(signedInfo22));
            Console.WriteLine(hashResult); Console.ReadKey();
            string canonicalHashedSignedInfo = Convert.ToBase64String(hashResult);
            Console.WriteLine(canonicalHashedSignedInfo); Console.ReadKey();