• shortwavesurfer@monero.town
        link
        fedilink
        English
        arrow-up
        27
        ·
        edit-2
        8 months ago

        Instead of having a secret that both you and the server share (password). Only you have the secret. Basically, what happens is that the server sends a message to your device encrypted that says, “If you are person, please give me back this code unencrypted.” And then it gives a code, for example. Your device decrypts that using your secret that you keep and then tells the server the code and the only way to have gotten that code is for you to have successfully decrypted the message the server sent.

        By doing it this way, if the server is ever compromised, then it contains no secrets for your account to be brute force decrypted by a hacker.

        • cole@lemdro.id
          link
          fedilink
          English
          arrow-up
          2
          ·
          8 months ago

          how does the server encrypt the message it sends without the secret? Or is that stored during sign up?

          • shortwavesurfer@monero.town
            link
            fedilink
            English
            arrow-up
            6
            ·
            8 months ago

            When you sign up, your device creates a public private key pair. It keeps the private key locally and sends the public key to the server. So instead of a username, you are nothing but a string of random characters representing your public key. You can see an example of this, if you go into the Linux terminal and type “ssh-keygen”

            • zerodawn@leaf.dance
              link
              fedilink
              English
              arrow-up
              1
              ·
              8 months ago

              Underrated explanation, you held it finally click for me. I consider myself a fairly educated person but just couldn’t wrap my head around what made it so special. Correct me if i’m wrong but my understanding is the server uses the public key to encrypt a challenge code that can only be decrypted by your private key. You get an on device prompt to approve the process and the rest is done under the hood.

              To go further on this, is the public/private key a mathematical relationship? What ties the two together to make them useful as a pair?

              • SandboxScience@feddit.de
                link
                fedilink
                English
                arrow-up
                2
                ·
                8 months ago

                Also no expert about the math behind it but this is how I learned asymmetric encryption with public and private key on a very high level of abstraction:

                To encrypt a message you basically take the unencrypted message to the power of the private key (lets call that d) and divide it by the result of a multiplication of two large prime numbers (lets call that N). Now you take the rest of that division, so basically modulo if you are familiar with that.

                To decrypt, you take the encrypted message to the power of the public key (e) and divide it by N. The rest of that operation is again the unencrypted message.

                So the private and public key are the pairs (d, N) and (e, N) respectively. The great thing about this is that you can post the public key publicly without care and only you, in possession of the private key, can decrypt messages encrypted with your public key. So its easy to verify if you got the key but hard to brute force due to modulo being a one way function. However, this basic RSA approach as described here is not used on its own anymore but rather in combination with other techniques to prevent guessing on very short messages or keys.

              • shortwavesurfer@monero.town
                link
                fedilink
                English
                arrow-up
                2
                ·
                8 months ago

                You got it. You authenticate with your biometrics. The server sends you a challenge. Your device decrypts that challenge locally and sends the server the response back. As for the mathematics behind it all, I am not the person to ask. I just know that it does work, and that quantum computers could be a serious problem in the future. But for now, they’re not.

            • cole@lemdro.id
              link
              fedilink
              English
              arrow-up
              1
              ·
              8 months ago

              good explanation, thank you! I’m very familiar with ssh key auth so that makes sense

          • shortwavesurfer@monero.town
            link
            fedilink
            English
            arrow-up
            2
            ·
            8 months ago

            No, because it’s a public private key pair, you have the private key and the server has the public key. So you end up sending the secret back encrypted as well. I just used that as an explainer. It’s not actually how that works.

        • fosiacat@lemmy.world
          link
          fedilink
          English
          arrow-up
          1
          arrow-down
          2
          ·
          8 months ago

          oh cool I get it. is this a good replacement for lastpass? I’ve been thinking about switching for a long time, but got kind of locked in to the convenience/cross platform compatibility (i use linux, macos, windows, ios regularly) but haven’t looked into keepass much.

          • Vash63@lemmy.world
            link
            fedilink
            English
            arrow-up
            7
            ·
            8 months ago

            Bitwarden is more of a direct replacement to Lastpass, but better and open source with self hosting options (see also Vaultwarden). Keepass is a safe stored and managed by you, no syncing or online services are included.

          • nyar@lemmy.world
            link
            fedilink
            English
            arrow-up
            6
            ·
            8 months ago

            There are extensions for it.

            Personally, I use syncthing to send my keepass database to the various devices I need it on.

          • shortwavesurfer@monero.town
            link
            fedilink
            English
            arrow-up
            3
            ·
            edit-2
            8 months ago

            From my personal experience switching from last pass, yes, it has been a very good replacement. Inside of LastPass, there is actually a way to get a spreadsheet with all your account details like username, password, URL, notes, etc and then import that into keepass. Once you have done that, you obviously delete the spreadsheet since it’s in plain text. However, I will say that keepass Is not right for everybody. You have to control your own database file and if you lose it, then you are shit out of luck. So you have to make sure that it is properly backed up and synced between devices. I use a quarterly backup strategy and a flash drive to accomplish this, but your choice may vary. However, using a cloud service of any kind to put the file on is probably not a great idea. If you must use a “cloud” I would highly suggest syncthing since you remain in control at all times.