Фрагмент программы для считывания ЭЛН из ФСС



//-- Создать первичный файл для сервиса getPrivateLNData

string regnum = "11111";
string eln = "22222";
string snils = "33333";
string filename = "D:\\temp\\FSS\\files\\test.xml";
string rez = api-fss.getPrivateLNData.Createfile(regnum, eln, snils, filename);

//-- Считать сертификат страхователя

SerialNumberCerClient = "01AB18273187CE28373423";
api-fss.Crypto_Certif cr1 = api-fss.Crypto_Certif.getCrypto_CertifClient(SerialNumberCerClient);
if (cr1.x509 == null) return;
X509Certificate2 x509client = cr1.x509;


//-- Подписать файл для сервиса getPrivateLNData

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);

//-- Считать сертификат ФСС

SerialNumberCerFSS = "2398423HG87KQ1728";
api-fss.Crypto_Certif cr2 = api-fss.Crypto_Certif.getCrypto_CertifFSS(SerialNumberCerFSS);
if (cr2.x509 == null) return;
X509Certificate2 x509FSS = cr2.x509;


//-- Зашифровать файл

string filein = "D:\\temp\\FSS\\files\\test1.xml";
string fileout = "D:\\temp\\FSS\\files\\test2.xml";
X509Certificate2 certificateToEncrypt = x509FSS;
X509Certificate2 certificateToDecrypt = x509client;
api-fss.FSSSignedXml.EncryptXmlElement( filein, fileout, certificateToEncrypt, certificateToDecrypt);


//-- Вызвать сервис getPrivateLNData

string filein = "D:\\temp\\FSS\\files\\test2.xml";
string fileout = "D:\\temp\\FSS\\files\\test3.xml";
api-fss.CallService.call_ServiceFSS_getPrivateLNData( filein, fileout, regNum, lnCode, snils);

//-- расшифровать файл

string filein = "D:\\temp\\FSS\\files\\test3.xml";
string fileout = "D:\\temp\\FSS\\files\\test4.xml";
X509Certificate2 certificate = x509client;
api-fss.FSSSignedXml.DecryptXml( filein, fileout, certificate);


Итоговый файл - test4.xml:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP-ENV:Header /> <SOAP-ENV:Body> <S:Envelope xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP-ENV:Header> <wsse:Security S:actor="http://eln.fss.ru/actor/fss/ca/102XXXXXXXXX"> <wsse:BinarySecurityToken wsu:Id="http://eln.fss.ru/actor/fss/ca/102XXXXXXXXX" 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">MIIIJTCCB9KgAwIBAgIRAMR1DVsR5NuA6BH0yrdPoB4wCgYIKoUDBwEBAwIwggEfMRwwGgYJKoZI hvcNAQkBFg11Y0B2b3NraG9kLnJ1MRgwFgYFKoUDZAESDTExNjc3NDYyODkyNDgxGjAYBggqhQMD gQMBARIMMDA3NzI5NDk4ODEzMQswCQYDVQQGEwJSVTEYMBYGA1UECAwPNzcg0JzQvtGB0LrQstCw MRkwFwYDVQQHDBDQsy4g0JzQvtGB0LrQstCwMTEwLwYDVQQJDCjRg9C70LjRhtCwINCj0LTQsNC7 0YzRhtC+0LLQsCwg0LTQvtC8IDg1MSkwJwYDVQQKDCDQpNCT0JHQoyDQndCY0JggwqvQktC+0YHR hdC+0LTCuzEpMCcGA1UEAwwg0KTQk9CR0KMg0J3QmNCYIMKr0JLQvtGB0YXQvtC0wrswHhcNMTgx MDA4MTIwNzI4WhcNMTkxMDA4MTIxNzI4WjCCAZQxGDAWBgUqhQNkARINMTAyNzczOTQ0MzIzNjEa MBgGCCqFAwOBAwEBEgwwMDc3MzYwNTY2NDcxNDAyBgNVBAkMK9Ce0YDQu9C40LrQvtCyINC/0LXR gNC10YPQu9C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SVcLPvO6jCGcfmOfdodaRiq3xJwal9FManQ==</wsse:BinarySecurityToken> <Signature xmlns="http://www.w3.org/2000/09/xmldsig#"> <SignedInfo> <CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#WithComments" /> <SignatureMethod Algorithm="urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102012-gostr34112012-256" /> <Reference URI="#OGRN_102XXXXXXXXX"> <Transforms> <Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#WithComments" /> </Transforms> <DigestMethod Algorithm="urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34112012-256" /> <DigestValue>lXOGEB1QTQ32qBpKxIOwUI+vO87y512CQ7+foLugj5Y=</DigestValue> </Reference> </SignedInfo> <SignatureValue>FnhE8V046LGj/knSzyGpLu9oA9Og+B4kTt3kXrx77yhcwlmdh8QuZ9LMq3PLBCBPOTaa6j4u//C9 euVYz7fsmg==</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/fss/ca/102XXXXXXXXX" /> </wsse:SecurityTokenReference> </KeyInfo> </Signature> </wsse:Security> </SOAP-ENV:Header> <S:Body wsu:Id="OGRN_102XXXXXXXXX"> <ns1:getPrivateLNDataResponse xmlns:ns2="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:ns1="http://ru/ibs/fss/ln/ws/FileOperationsLn.wsdl"> <ns1:FileOperationsLnUserGetPrivateLNDataOut> <ns1:REQUEST_ID>GETLNINS_111111_2019_09_20_00001</ns1:REQUEST_ID> <ns1:STATUS>1</ns1:STATUS> <ns1:DATA> <ns1:OUT_ROWSET> <ns1:ROW> <ns1:SNILS>33333</ns1:SNILS> <ns1:SURNAME>XXXXXXXX</ns1:SURNAME> <ns1:NAME>XXXXX</ns1:NAME> <ns1:PATRONIMIC>XXXXXXXX</ns1:PATRONIMIC> <ns1:BOZ_FLAG>0</ns1:BOZ_FLAG> <ns1:LPU_EMPLOYER>XXX XXXXXXXX</ns1:LPU_EMPLOYER> <ns1:LPU_EMPL_FLAG>1</ns1:LPU_EMPL_FLAG> <ns1:LN_CODE>22222</ns1:LN_CODE> <ns1:PRIMARY_FLAG>1</ns1:PRIMARY_FLAG> <ns1:DUPLICATE_FLAG>0</ns1:DUPLICATE_FLAG> <ns1:LN_DATE>2019-02-25</ns1:LN_DATE> <ns1:LPU_NAME>XXXXXXXX</ns1:LPU_NAME> <ns1:LPU_ADDRESS>XXXXXXXX</ns1:LPU_ADDRESS> <ns1:LPU_OGRN>103XXXXXX</ns1:LPU_OGRN> <ns1:BIRTHDAY>1989-12-11</ns1:BIRTHDAY> <ns1:GENDER>1</ns1:GENDER> <ns1:REASON1>09</ns1:REASON1> <ns1:DATE1 xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" /> <ns1:DATE2 xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" /> <ns1:SERV1_AGE>6</ns1:SERV1_AGE> <ns1:SERV1_MM xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" /> <ns1:SERV1_RELATION_CODE>38</ns1:SERV1_RELATION_CODE> <ns1:SERV1_FIO>XXXXXXXX</ns1:SERV1_FIO> <ns1:SERV2_AGE xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" /> <ns1:SERV2_MM xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" /> <ns1:PREGN12W_FLAG xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" /> <ns1:HOSPITAL_DT1 xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" /> <ns1:HOSPITAL_DT2 xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" /> <ns1:MSE_DT1 xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" /> <ns1:MSE_DT2 xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" /> <ns1:MSE_DT3 xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" /> <ns1:MSE_INVALID_GROUP xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" /> <ns1:TREAT_PERIODS> <ns1:TREAT_FULL_PERIOD> <ns1:TREAT_PERIOD> <ns1:TREAT_DT1>2019-02-25</ns1:TREAT_DT1> <ns1:TREAT_DT2>2019-03-01</ns1:TREAT_DT2> <ns1:TREAT_DOCTOR_ROLE>Педиатр</ns1:TREAT_DOCTOR_ROLE> <ns1:TREAT_DOCTOR>XXXXXXXXX</ns1:TREAT_DOCTOR> </ns1:TREAT_PERIOD> </ns1:TREAT_FULL_PERIOD> </ns1:TREAT_PERIODS> <ns1:LN_RESULT> <ns1:RETURN_DATE_LPU>2019-03-02</ns1:RETURN_DATE_LPU> <ns1:OTHER_STATE_DT xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" /> </ns1:LN_RESULT> <ns1:LN_STATE>060</ns1:LN_STATE> <ns1:INN_PERSON>66XXXXXXXXX</ns1:INN_PERSON> <ns1:EMPLOYER>ООО XXXXXXXXX</ns1:EMPLOYER> <ns1:EMPL_FLAG>1</ns1:EMPL_FLAG> <ns1:EMPL_REG_NO>111111</ns1:EMPL_REG_NO> <ns1:EMPL_PARENT_NO>66XXX</ns1:EMPL_PARENT_NO> <ns1:APPROVE1>XXXXXX</ns1:APPROVE1> <ns1:APPROVE2>YYYYYYY</ns1:APPROVE2> <ns1:BASE_AVG_SAL>YYYYYYY</ns1:BASE_AVG_SAL> <ns1:BASE_AVG_DAILY_SAL>YYYYYY</ns1:BASE_AVG_DAILY_SAL> <ns1:INSUR_YY>7</ns1:INSUR_YY> <ns1:INSUR_MM>10</ns1:INSUR_MM> <ns1:NOT_INSUR_YY>0</ns1:NOT_INSUR_YY> <ns1:NOT_INSUR_MM>0</ns1:NOT_INSUR_MM> <ns1:FORM1_DT xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" /> <ns1:RETURN_DATE_EMPL>2019-03-02</ns1:RETURN_DATE_EMPL> <ns1:DT1_LN>2019-02-25</ns1:DT1_LN> <ns1:DT2_LN>2019-03-01</ns1:DT2_LN> <ns1:EMPL_PAYMENT>XXXXXX</ns1:EMPL_PAYMENT> <ns1:FSS_PAYMENT>XXXXXXX</ns1:FSS_PAYMENT> <ns1:PAYMENT>XXXXXX</ns1:PAYMENT> <ns1:CORRECTION_REASON>06</ns1:CORRECTION_REASON> <ns1:CORRECTION_NOTE>test</ns1:CORRECTION_NOTE> <ns1:LN_HASH>948</ns1:LN_HASH> </ns1:ROW> </ns1:OUT_ROWSET> </ns1:DATA> </ns1:FileOperationsLnUserGetPrivateLNDataOut> </ns1:getPrivateLNDataResponse> </S:Body> </S:Envelope> </SOAP-ENV:Body> </SOAP-ENV:Envelope>



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