Porovnávané verzie

Kľúč

  • Tento riadok sa pridal
  • Riadok je odstránený.
  • Formátovanie sa zmenilo.

...

  • Unsecured connection. Although the JAPI protocol is binary, all texts are transmitted in a readable way. An unsecured connection is good when debugging or in the case when communication commConfiguration of the D2Connector Process for SmartWebunication between  D2Connector and JConnector runs in a secure network. 
  • Connection secured by the TLS v1.2 protocol. JAPI and D2Connectorcommunicate with each other by an encrypted protocol while D2Connector shows its identity by a certificate and a private key which JConnector compares with its own certificate. (Supported from the 10.1.39 version)

...

For establishing the TLS connection, it is necessary for one party to be in the role of the "TLS server" and the second party in the role of the "TLS client" while these roles are not dependent on who initiated the TCP connection. The "TLS server" shows a certificate to which it owns a personal key. The "TLS client" verifies the license validity and the key authenticity5. For JAPI, the vždy D2Connector a „TLS klient" vždy JConnector.

Predpokladom pre vytvorenie zabezpečeného spojenia je, že máme RSA kľúčový pár a k nemu X.509 certifikát. Certifikát je uložený v súbore vo formáte *.crt a musí mať k jeho kópii prístup aj D2Connector aj JConnector. Privátny kľúč je uložený v nešifrovanej forme v súbore vo formáte *.pem a prístup k nemu musí mať iba JConnector. Vzhľadom k tomu, že JConnector považuje D2Connector za dôveryhodný iba na základe toho, že sa preukázal rovnakým certifikátom, ako očakával, použitý certifikát môže byť „self-signed" a nie je vôbec potrebné získať certifikát od nejakej certifikačnej autority.

Varovanie

POZOR: Z bezpečnostného hľadiska je veľmi dôležité, aby bol súbor s certifikátom uložený tak, aby ho nikto bez príslušného oprávnenia nemohol zmeniť. (Na čítanie môže byť verejný.) Takisto je veľmi dôležité, aby súbor so súkromným kľúčom mohol prečítať iba D2Connector a nikto ho nemohol zmeniť. V prípade porušenia týchto podmienok hrozí kompromitácia dôveryhodnosti certifikátu a otvára sa možnosť odpočúvania zabezpečenej komunikácie.

"TLS server" is always D2Connector and the "TLS client" is always JConnector.

The requirement for creating a secure connection is that we have the RSA key pair and the X.509 certificate. The certificate is stored in the file in the *.crt format and both D2Connector and JConnector have to have access to its copies. The private key is stored in an unencrypted form in the file in the *.pem format and only JConnector has to have access to it.  Since JConnector considers D2Connector trustworthy only based on showing the certificate it expected, the used certificate can be "self-signed" and it is not necessary to acquire the certificate from some certification authority. 

Varovanie

WARNING: From security reasons, it is very important for the file with a certificate to be stored in such a way that no one without given permission could change it (it can be public for reading). It is also very important that the file with a private key could be read only by D2Connector and no one could change it. In a case of breaking these conditions, there is a danger of compromising the certificate's trustworthiness and there is a possibility of wiretapping of secured communication. 

It is necessary to run D2Connector with parameters D2Connector je potrebné spustiť s parametrami --CONNECTOR_TLS_CERT a  and --CONNECTOR_TLS_PK, ktoré odkazujú na súbory s certifikátom a súkromným kľúčom. V príklade je certifikát uložený v súbore certificate.crt a súkromný kľúč v súbore private.pem. Podľa potreby sa môže použiť aj parameter --DCC alebo  which refer to files with a certificate and a private key. In the example, the certificate is stored in the file certificate.crt and the private key in the file private.pem. According to the needs, also parameters  --DCC or --CONNECTOR_LISTEN_PORT can be used. 

Blok kódu
languagepowershell
themeEclipse
> d2connector.exe --CONNECTOR_TLS_CERT=certificate.crt --CONNECTOR_TLS_PK=private.pem

Vytvorenie certifikátu pre účely zabezpečeného spojenia

Creatinig a Certificate for Purposes of Secure Connection

For creating a "self-signed" certificate, it is possible to use for example the application OpenSSL from a command line. First, we have to create a key pair for the RSA code. In the example, we generate a 2048 bit key pair into the file Pre vytvorenie „self-signed" certifikátu je možné použiť napríklad aplikáciu OpenSSL z príkazového riadku. Najskôr musíme vytvoriť kľúčový pár pre RSA šifru. V príklade generujeme 2048 bitový kľúčový pár do súboru private.pem.

Blok kódu
languagepowershell
themeEclipse
> openssl.exe genrsa -out private.pem 2048

Ku kľúčovému páru vytvoríme „Certificate Signing Request" žiadosť o vystavenie certifikátu, ktorá bude uložená v súbore To the key pair, we create a "Certificate Signing Request" request for drawing certificate that would be stored in the file request.csr. OpenSSL sa opýta na viaceré údaje, ktoré zapíše do žiadosti a ktoré budú vo výslednom certifikáte uvedené. JAPI však tieto údaje neskúma a nekontroluje.queries more data which it writes into the request and which will be stated in the final certificate. However, JAPI does not examine or check this data. 

Blok kódu
languagepowershell
themeEclipse
> openssl.exe req -new -key private.pem -out request.csr

Následne podpíšeme žiadosť vygenerovaným súkromným kľúčom, čím z neho vytvoríme „selfsigned" certifikát, ktorý bude v súbore certificate.crt. Certifikát bude mať platnosť 365 dní počínajúc aktuálnym časom.Then, we sign the request by a generated private key. This way, we create "selfsigned" certificate that will be located in the file certificate.crt. The certificate will be valid for 365 days starting with the current time. 

Blok kódu
languagepowershell
themeEclipse
> openssl.exe x509 -req -days 365 -in request.csr -signkey private.pem -out certificate.crt

...