monich / harbour-foilauth

Secure OTP (One-Time Password) generator for Sailfish OS
https://openrepos.net/content/slava/foil-auth
Other
11 stars 6 forks source link

how to decrypt without the app #25

Closed vista-narvas closed 3 years ago

vista-narvas commented 3 years ago

Hi, i have been using this program for a while, but my phone recently stopped working i have backups of everything but i don't know how to decrypt the files and extract the keys

i did compile foil and was able to kind of decrypt the file i am interested in using the command ./foilmsg -d -f FoilFile -s foil.key -o output.file -v -P "***pass***" -i the output

[foilmsg] Private key fingerprint: 59:e8...c8:ca
Format: 1
Sender fingerprint:
  Format: 1 (rsa-ssh)
  Data: 16 bytes
    59 e8 86 ... 63 c8 ca
Key format: 3 (AES-256)
Keys:
  1. Fingerprint:
       Format: 1 (rsa-ssh)
       Data: 16 bytes
         59 e8 86 ... 63 c8 ca
     Encryption key: 188 bytes
       cd 7c 35 0a 48 8c 44 7b  78 83 d2 cd d1 a9 51 18
       ...
       15 42 61 ea e2 40 26 ec  16 90 b2 82 7f c3 b9 00

Encrypted data:
  Cipher: 1 (AES-CBC)
  Data: 64 bytes
    dd 20 fa da 62 db 96 d5  f1 1b 3f 67 6f 09 60 74
    ...
    c8 59 f8 04 10 e6 0e fa  6a 57 62 b8 4e 7d 23 ea
Signature:
  Format: 1 (MD5-RSA)
  Data: 188 bytes
    b4 ad e5 1a 28 9e b9 18  82 dc 66 de cd d9 e0 73
    ...
    0f 0d f7 14 98 59 cb 11  5d 13 c2 03 30 1f d4 f2

but i don't know how i can get the key from the output or the output file it looks like its still encrypted or binary data

I would appreciate it if you could provide me with instructions on how decrypt these files (preferably for Linux)

monich commented 3 years ago

You did almost the right thing, just remove the -i option. For example:

slava@master $ ls -la output.file 
ls: cannot access output.file: No such file or directory
slava@master $ foilmsg -d -f FoilFile -s foil.key -o output.file -P $PASSWORD
slava@master $ ls -la output.file 
-rw-r--r-- 1 slava slava 20 Sep 28 16:54 output.file
slava@master $ 

Note that output.file is binary, you would need to run it through base32 encoder in order to transform it into the string which you see in the app when you edit the token.

vista-narvas commented 3 years ago

ooh it was a easier solution than i expected Thank you for this app and taking the time to answer my question