Got acquainted with openssl : RSA. It could be easier . Now I think about where to apply the resulting algorithms.

  1. Is it possible to make authorization on the site with the encryption of the login and password? For transmission over an unprotected connection? I think I saw such a thing on JS somewhere. In theory, this is done via https, but for this you need to buy a certificate.
  2. What methods can be used to store passwords in the program? Now they are stored in a text file in an open form. I believe that you can sew two RSA keys into the program and encrypt it when writing to disk. Although who prevents to break the program and pull out the keys.
  • Not familiar with the implementation of RSA in openssl, but as I was taught - never implement RSA yourself. There are many attacks aimed at the used memory for the time spent in encrypting / decrypting text, etc. Who knows why the “no memory write flag” was set — perhaps this is just one of the tools that prevents RSA from breaking through memory? If we are acquainted with RSA, then definitely not on such articles. Now, by the way, on coursera.org the cycle of lectures on encryption is just ending. A new course is about to start soon - it will be useful to get acquainted) - BOPOH

2 answers 2

  1. It is possible, but you still have to invent something similar to certificate verification. The fact is that RSA, like any other asymmetric encryption algorithm, is prone to MItM attack, that is, you need to be sure that the site / server is what it claims to be.
  2. You can not store passwords - you need to store the password hash, but if you really want, then you need to store the encrypted password, however, immediately a collision arises - with what password to encrypt the password? Usually, it is customary to use a combination of a device identifier as the password for encrypting a password: motherboard id, network card MAC address, device IMEI, depending on the task. In this case, if the encrypted password is leaked, there will be some guarantee of non-opening.

    1) Well, you can sign the certificate yourself) Causes some inconveniences (especially when you post the game on FB and the user enters via https), but for the first time, in principle, it will. And if things go uphill, then it will be possible to buy a normal certificate.

    Authorization can be done, the search even gave some kind of JS-library . That's just ...

    And how will you transfer this key to the client? By http? Well, no one bothers to wedge between the client and the server and give the client their keys. And then proxy requests to the original server with re-encryption with your key (i.e., the attacker's key). This alone kills all protection.

    And how are you going to implement? Login and password to encrypt separately? Well then it will not be anything different from complex logins / passwords. So it will be necessary in some way to combine the login / password into one line and encrypt the result already.

    But there is also a problem: there is a certain dictionary of logins and passwords; for these dictionaries, based on the intercepted key, you can generate ciphertexts and check sent messages based on the intercepted key login / password for the presence in this list. It will be expensive, of course, but there will always be those who wish, at least for the sake of entertainment.

    If, however, cast aside doubts and decide to do it, then it may be worthwhile to take into account that 1K keys are no longer considered reliable. Mozila even from the beginning of the year redesignt certificates with such keys.

    2) No one bothers. When creating software, Google Play even advises (at least advised before, now they have changed the payment method), their key (that is, one key, not two, the second one is stored) to split into several parts and scatter in different places to make it harder to unlock the key.

    Perhaps you should not sew the keys, and generate them during installation? Although, wherever you put the keys - the admin will always be able to see them.

    And maybe it is worth storing in the program not a login / password, but, for example, md5 from a login / password - i.e. Text is entered, is md5 applied to it and sranivatsya with the saved data?