How the it-animals team won the Digital Breakthrough finals

This article was co-authored with @ Restlin's team lead





Case selection and our vision of its solution

Initially, the choice fell on the case of the Ministry of Internal Affairs: Development of an autonomous software solution for linguistic analysis and transformation of the narrative face in the text.





Case formulation:





Taking into account the specifics of the activities of certain services of the Ministry of Internal Affairs of Russia, when preparing documents, the transformation of the face of the narration from the first person into the third, taking into account the gender, is required in the text. For example, the phrase in the original text “I saw that Ivanov went to me” in the final text should be transformed into “He saw that Ivanov went to him”. The developed software solution will automatically carry out the process of converting the face of the story, which will allow employees to devote more time to other aspects of their work. The case was prepared by the Department of Information Technologies, Communications and Information Protection of the Ministry of Internal Affairs of Russia. 





He was close to us in specialization, and there was a clear idea of ​​how beautifully this problem could be solved.





It was planned that we will create a web service that can automatically convert the testimony of a first-person to a third-person witness.





 Everything went as well as possible until the moment when we watched the video with the presentation of the case from the case holder, what they expect at the exit: 





  1. local solution that works without network access; 





  2. integrated office suites through macros.





Our team was divided into 2 camps: half insisted on strict adherence to the requirements of the case holder, otherwise the case should be changed, the second insisted on the primary solution (offtopic: a similar decision shot from other guys and they won).





, : , .





:





« » , . , , , , . (, ). - , ( Creatio). .





? Open source : OpenSSL. - php tcpdf pdf . pirs.online , .





, .





,  . - , ASP.NET. 





( : ? , . 





?

: , .





: , . - . , , . - .





:





  • : ;





  • ( );





  • ;





  • ;





  • ;





  • ;





  • ;





  • .





3 , PostgreSQL: 





  1. user - ;





  2. message - . ;





  3. file - , .





php- Yii2 . .





OpenSSL, - .





, . - (libengine-gost-openssl 1.1) , -2012. .





: . - , , . ! 





PHP openssl , , , openssl engine .





openssl . , openssl.





:





exec("openssl req -nodes -newkey gost2012_512 -keyout $eSignPath/client.key -pkeyopt paramset:A -out $eSignPath/client.csr -subj \"/C=RU/ST=Udm/L=Izhevsk/O=IT/OU=animals/CN=user-{$user->id}\" -config $caPath/openssl.cnf ");







exec("openssl ca -engine gost -keyfile $caPath/ca.key -cert $caPath/ca.crt -in $eSignPath/client.csr -out $eSignPath/client.crt -batch -config $caPath/openssl.cnf 2>&1", $output);







$eSignPath



- , $caPath



- .





:





exec("openssl ca -config $caPath/openssl.cnf -keyfile $caPath/ca.key -cert $caPath/ca.crt -revoke $eSignPath/client.crt 2>&1", $output);







exec("openssl ca -gencrl -config $caPath/openssl.cnf -keyfile $caPath/ca.key -cert $caPath/ca.crt -out $caPath/crl.pem 2>&1", $output);







$eSignPath



- , $caPath



- .





:





exec("openssl smime -engine gost -sign -in $fp -out $fp.sig -nodetach -binary -signer $clientKeysPath/client.crt -inkey $clientKeysPath/client.key -outform SMIME 2>&1", $output);







$fp



- , $clientKeysPath



- .





:





$output = exec("openssl cms -engine gost -verify -in $sigPath -inform SMIME -CAfile $pathCA/ca.crt -out $fp -certsout $clientKeysPath/client.crt 2>&1");







$fp



- , $clientKeysPath



- , $sigPath



- .





openssl - .   , , . , : - .





: , tcpdf pdf pdf . , pdf .





: . , , , . , .





tcpdf openssl. . openssl (-,  ) api:





$fields = [







'r' => 'api/sign',







'filePath' => $tempdoc,







'userId' => $user->id,







];







$query = http_build_query($fields);







$ch = curl_init();







$host = \Yii::$app->params['apiHost'] ?? '';







curl_setopt($ch, CURLOPT_URL, $host . '/index.php?' . $query);







curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);







$signature = curl_exec($ch);







/*if (empty($this->signature_data['extracerts'])) {







openssl_pkcs7_sign($tempdoc, $tempsign, $this->signature_data['signcert'], array($this->signature_data['privkey'], $this->signature_data['password']), array(), PKCS7_BINARY | PKCS7_DETACHED);







} else {







openssl_pkcs7_sign($tempdoc, $tempsign, $this->signature_data['signcert'], array($this->signature_data['privkey'], $this->signature_data['password']), array(), PKCS7_BINARY | PKCS7_DETACHED, $this->signature_data['extracerts']);







}*/







!





Zoom , , . 





: ,   ( 5 ) . 





Unexpectedly, the results had to wait until the evening, although the winners were announced at the North-West Hub almost an hour after the defense. Time dragged on as the delivery of the Russian Post.





Offtop: we are the winners! 750 thousand per team, Karl! 750 in 2 days, Karl! And that means we are going to the Grandfinal of the Digital Breakthrough in Moscow!



Our solution repository








All Articles