Cannt decrypt backup with private key

Hello, beginner here. I am having problems testing my backups with OneDrive as I cannot get Duplicacy to decrypt the files. The specific issue is reading the private key as I run into one of two errors; one is that it cannot find the private key and the other is that it is unable to read the private key. I already followed this guide How to use RSA Key from CLI encrypted backups with Web GUI Restore.
This is what Duplicacy reads:

2024-01-05 13:47:53.830 INFO REPOSITORY_SET Repository set to /backuproot/user/Sebastian/temptest
2024-01-05 13:47:53.830 INFO STORAGE_SET Storage set to one://WorkingWhonnock
2024-01-05 13:47:54.341 INFO SNAPSHOT_FILTER Loaded 1 include/exclude pattern(s)
2024-01-05 13:47:54.889 ERROR RSA_PRIVATE Failed to read the private key file: open /backuproot/user/Sebastian/DuplicacyWorkingWhonnock.pem: permission denied

I imagine it is something basic that im doing wrong.

Edit, got it to read it fine but now I have a different error. I can read the private key but duplicacy states: asn1: syntax error: sequence truncated and it has the same exit code: 100.

Private key always result to error: sequence truncated - #2 by gchen - i tried following this but the -traditional flag doesnt work anymore so im stuck.

Edit 2, looks like the type of key I am generating and there is a rabbit hole of what type of key you need to generate, as i said before the -traditional flag aint working so im trying to find a way to make a key in the PKCS#1 format without the traditional flag. This is my last lead: Duplicacy restore of encrypted backup fails with error - #11 by anym001

Edit 3. Not much more luck. I booted up a ubuntu server that had a old enough openssl version that supported the -traditional flag and when I moved those keys over to my unraid server, made sure all the permissions were correct so duplicacy can read them I get the same error:
asn1: syntax error: sequence truncated
with exit code 100.

Im stuck please help… anyone.

here is the full output of trying to run the restore:
2024-01-07 04:31:43.761 INFO REPOSITORY_SET Repository set to /backuproot/user/restorehere
2024-01-07 04:31:43.762 INFO STORAGE_SET Storage set to /backuproot/user/backuptest
2024-01-07 04:31:43.762 INFO SNAPSHOT_FILTER Loaded 1 include/exclude pattern(s)
2024-01-07 04:31:43.775 ERROR RSA_PRIVATE Failed to parse the private key in /backuproot/user/domains/private.pem: asn1: syntax error: sequence truncated

and the restore options command i put in:
-key /backuproot/user/domains/private.pem -key-passphrase

(for some reason the greater than and lesser than brackets arent showing, prob some formating thingy for the forums, options command should look like this: How to use RSA Key from CLI encrypted backups with Web GUI Restore - #4 by gchen)

edit. I am stupid.

I had the wrong passcode the whole time, in the restore command you should have just your passcode, without the > and <

In summary if someone is having the same problem make sure that first you have generated the correct format keys using

openssl genrsa -aes256 -out private.pem 2048
openssl rsa -in private.pem -pubout -out public.pem

Then make sure that the files are allowed to be read by Duplicacy (this is typically a chown command)

When you run the backup (for GUI) and try to restore make sure to use the optional command:

-key path/private.pem -key-passphrase <passphrase>

MAKE SURE THAT YOUR PASSPHASE IS JUST ALONE WITHOUT THE ><
For example a command would look like

-key /backuproot/user/keys/DuplicacyPrivateKey.pem -key-passphrase StRoN6PassW0rD

anything else I cant help with as this is all that solved my problem. Sorry if this didnt help anyone.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.