Функция "Подписать файл для сервиса getPrivateLNData"


Наименование функции - api-fss.FSSSignedXml.SignXmlFile


Назначение функции - подпись файла с помощью указанного сертификата.


При успешном выполнении файл подписывается указанным сертификатом, результат сохраняется в файл с заданным именем.
Иначе - возвращается строка "Ошибка. " + Exception.Message.


Параметры функции:

  • filein - имя входного файла
  • fileout - имя выходного (подписанного) файла
  • Certificate - сертификат страхователя
  • regnum - регистрационный номер страхователя в ФСС

Пример вызова функции:

string regnum = "11111";
string filein = "D:\\temp\\FSS\\files\\test.xml";
string fileout = "D:\\temp\\FSS\\files\\test1.xml"
X509Certificate2 Certificate = x509client;
api-fss.FSSSignedXml.SignXmlFile(filein, fileout, Certificate, regnum);


Пример xml-файла:

<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:eln="http://ru/ibs/fss/ln/ws/FileOperationsLn.wsdl" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"> <S:Header> <wsse:Security S:actor="http://eln.fss.ru/actor/insurer/11111"> <wsse:BinarySecurityToken wsu:Id="http://eln.fss.ru/actor/insurer/11111" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3" EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">MIIJLTCCCNqgAwIBAgIQQ42dABeqNYlOtO7tr2KntTAKBggqhQMHAQEDAjCCAd0xGDAWBgUqhQNkARINMTA4NTAzMTA1ODg4MTEaMBgGCCqFAwOBAwEBEgwwMDUwMzEwODIzMDkxCzAJBgNVBAYTAlJVMS8wLQYDVQQIDCY1MCDQnNC+0YHQutC+0LLRgdC60LDRjyDQvtCx0LvQsNGB0Y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UCIwgaQGA1UdHwSBnDCBmTBMoEqgSIZGaHR0cDovL3VjLnByb2ZpLW1vLnJ1L2NkcC84NWZkN2YwZGE3NDNlZmI0OTYwMDlhMGM1ZWRiYmM4NTU2YjRhZjBmLmNybDBJoEegRYZDaHR0cDovL3Byb2ZpLW1vLnJ1L2NkcC84NWZkN2YwZGE3NDNlZmI0OTYwMDlhMGM1ZWRiYmM4NTU2YjRhZjBmLmNybDCCAWAGA1UdIwSCAVcwggFTgBSF/X8Np0PvtJYAmgxe27yFVrSvD6GCASykggEoMIIBJDEeMBwGCSqGSIb3DQEJARYPZGl0QG1pbnN2eWF6LnJ1MQswCQYDVQQGEwJSVTEYMBYGA1UECAwPNzcg0JzQvtGB0LrQstCwMRkwFwYDVQQHDBDQsy4g0JzQvtGB0LrQstCwMS4wLAYDVQQJDCXRg9C70LjRhtCwINCi0LLQtdGA0YHQutCw0Y8sINC00L7QvCA3MSwwKgYDVQQKDCPQnNC40L3QutC+0LzRgdCy0Y/Qt9GMINCg0L7RgdGB0LjQuDEYMBYGBSqFA2QBEg0xMDQ3NzAyMDI2NzAxMRowGAYIKoUDA4EDAQESDDAwNzcxMDQ3NDM3NTEsMCoGA1UEAwwj0JzQuNC90LrQvtC80YHQstGP0LfRjCDQoNC+0YHRgdC40LiCCwCYx8FwAAAAAABBMAoGCCqFAwcBAQMCA0EA/42rIjP52RYOsTajDwrPaZ7i6eeev6UZBgpuy99gqE6VdnwK8COjss7dknz7buNw0aaxfwyuaLbtRud5SmGvJw==</wsse:BinarySecurityToken> <Signature xmlns="http://www.w3.org/2000/09/xmldsig#"> <SignedInfo> <CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /> <SignatureMethod Algorithm="urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102012-gostr34112012-256" /> <Reference URI="#REGNO_11111"> <Transforms> <Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /> </Transforms> <DigestMethod Algorithm="urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34112012-256" /> <DigestValue>Qy6ms5hKhK881MSJ3UWjx8i/XlRNMsW7xiT5ik/rbc0=</DigestValue> </Reference> </SignedInfo> <SignatureValue>9ke9TV33K6ngF6hTrXi5Blt2krcKagzlvtajSFx3XSATe8HF60F5Cn1jt6o7MDVZKmFZvJMeTIfAqYx8zqqoaA==</SignatureValue> -<KeyInfo> -<wsse:SecurityTokenReference> <wsse:Reference ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3" URI="#http://eln.fss.ru/actor/insurer/6613304526" /> </wsse:SecurityTokenReference> </KeyInfo> </Signature> </wsse:Security> </S:Header> <S:Body wsu:Id='REGNO_11111'> <ns1:getPrivateLNData xmlns:ns1="http://ru/ibs/fss/ln/ws/FileOperationsLn.wsdl" xmlns:ns2="http://ru/ibs/fss/ln/ws/FileOperationsLnInternal.wsdl"> <ns1:regNum>11111</ns1:regNum> <ns1:lnCode>22222</ns1:lnCode> <ns1:snils>33333</ns1:snils> </ns1:getPrivateLNData> </S:Body> </S:Envelope>



Вернуться на главную страницу