Difference between revisions of "SDI Certificates"

From wiki.ferrari.mo.it
Jump to navigation Jump to search
Line 89: Line 89:
  
 
  mv FI.EE101944340.2024106.2330.901.zip.p7m.enc /home/sogei/DatiVersoSdITest/FI.EE101944340.2024106.2330.901.zip
 
  mv FI.EE101944340.2024106.2330.901.zip.p7m.enc /home/sogei/DatiVersoSdITest/FI.EE101944340.2024106.2330.901.zip
 +
 +
For checks:
 +
 +
https://sdi.fatturapa.gov.it/SdI2FatturaPAWebSpa/AccediAlServizioAction.do?pagina=gestire_canale&l=it

Revision as of 20:05, 16 April 2024

Files supplied by SDI

- PHXAT002.FRRFBA78L29B819H.cifra.p12;

- PHXAT002.FRRFBA78L29B819H.firma.p12;

- CAEntrate.pem;

- sogeiunicocifra.pem;

- Sogei_SdI1.pub;

- Sogei_SdI2.pub.

The first 2 files are protected by a password.

Extracting certificates and keys

openssl pkcs12 -in PHXAT002.FRRFBA78L29B819H.firma.p12 -out firma.pem -legacy
(enter supplied password)
(enter new password, 2 times)

openssl pkcs12 -in PHXAT002.FRRFBA78L29B819H.cifra.p12 -out cifra.pem -legacy
(enter supplied password)
(enter new password, 2 times)

This operation needs to be done only 1 time.

Sign and crypt a file (test)

cp /dir/file.xml .
(edit and change CodiceDestinatario)

openssl smime -sign -in file.xml -outform der -binary -nodetach -out file.xml.p7m -signer firma.pem
(enter password created before)

openssl smime -encrypt -in file.xml.p7m -outform der -binary -aes256 -out file.xml.p7m.enc sogeiunicocifra.pem

rm file.xml

rm file.xml.p7m

mv file.xml.p7m.enc /dir/DatiVersoSdITest/

chown sogei:sogei /dir/DatiVersoSdITest/file.xml.p7m.enc

Test codes

PA

- FTPTGU;

- FTPKEP;

- FTPVGY.

B2B

- FTPGGSL;

- FTPGXYI;

- FTPURGT.

Tests

File FI.EE101944340.2024106.2330.901.xml:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:FileQuadraturaFTP xmlns:ns2="http://www.fatturapa.it/sdi/ftp/v2.0" versione="2.0">
    <IdentificativoNodo>EE101944340</IdentificativoNodo>
    <DataOraCreazione>2024-04-15T23:30:00<DataOraCreazione>
    <NomeSupporto>FRRFBA78L29B819H_3_2024-03-31.xml</NomeSupporto>
    <NumeroFile>
        <File>
            <Tipo>FA</Tipo>
            <Numero>1</Numero>
        </File>
    </NumeroFile>
</ns2:FileQuadraturaFTP>
zip FI.EE101944340.2024106.2330.901.zip FI.EE101944340.2024106.2330.901.xml FRRFBA78L29B819H_3_2024-03-31.xml
openssl smime -sign -in FI.EE101944340.2024106.2330.901.zip -outform der -binary -nodetach -out FI.EE101944340.2024106.2330.901.zip.p7m -signer firma.pem
openssl smime -encrypt -in FI.EE101944340.2024106.2330.901.zip.p7m -outform der -binary -aes256 -out FI.EE101944340.2024106.2330.901.zip.p7m.enc sogeiunicocifra.pem
chown sogei:sogei FI.EE101944340.2024106.2330.901.zip.p7m.enc
mv FI.EE101944340.2024106.2330.901.zip.p7m.enc /home/sogei/DatiVersoSdITest/FI.EE101944340.2024106.2330.901.zip

For checks:

https://sdi.fatturapa.gov.it/SdI2FatturaPAWebSpa/AccediAlServizioAction.do?pagina=gestire_canale&l=it