"Object reference not set to an instance of an object" encrypton error


I’ve got the same error when trying to upload a folder from my comp. to either Backbase B2 Cloud or an SFTP (SSH) server. When I push “Run now” I’ve got an error message:
"Object reference not set to an instance of an object"
and in log this appears:

System.NullReferenceException: Object reference not set to an instance of an object
  at SharpAESCrypt.SharpAESCrypt+SetupHelper.CalculateKeyHmac () <0x40ecc550 + 0x00012> in <filename unknown>:0 
  at SharpAESCrypt.SharpAESCrypt.WriteEncryptionHeader () <0x40eca640 + 0x001db> in <filename unknown>:0 
  at SharpAESCrypt.SharpAESCrypt.get_Crypto () <0x40eca5b0 + 0x00037> in <filename unknown>:0 
  at SharpAESCrypt.SharpAESCrypt.FlushFinalBlock () <0x40ecc700 + 0x00693> in <filename unknown>:0 
  at SharpAESCrypt.SharpAESCrypt.Dispose (Boolean disposing) <0x40ecc600 + 0x00047> in <filename unknown>:0 
  at System.IO.Stream.Close () <0x40b44910 + 0x00018> in <filename unknown>:0 
  at System.IO.Stream.Dispose () <0x40c32fb0 + 0x00013> in <filename unknown>:0 
  at Duplicati.Library.Encryption.EncryptionBase.Encrypt (System.IO.Stream input, System.IO.Stream output) <0x40ec4440 + 0x00079> in <filename unknown>:0 
  at Duplicati.Library.Encryption.EncryptionBase.Encrypt (System.String inputfile, System.String outputfile) <0x40ec4360 + 0x00065> in <filename unknown>:0 
  at Duplicati.Library.Main.BackendManager+FileEntryItem.Encrypt (IEncryption encryption, IBackendWriter stat) <0x40ec41d0 + 0x000bd> in <filename unknown>:0 
  at Duplicati.Library.Main.BackendManager.Put (Duplicati.Library.Main.Volumes.VolumeWriterBase item, Duplicati.Library.Main.Volumes.IndexVolumeWriter indexfile, Boolean synchronous) <0x40ec3d60 + 0x00133> in <filename unknown>:0 
  at Duplicati.Library.Main.Operation.BackupHandler.UploadSyntheticFilelist (Duplicati.Library.Main.BackendManager backend) <0x40edc0a0 + 0x00ceb> in <filename unknown>:0 
  at Duplicati.Library.Main.Operation.BackupHandler.Run (System.String[] sources, IFilter filter) <0x40e7e000 + 0x010d3> in <filename unknown>:0 

Do you have any suggestion?


Hello @Eszter_Ari, welcome to the forum!

I moved your post to it’s own topic because yours seems to be related to an AES encryption issue rather than a filter problem like in the other topic. Oh, and I edited your post by putting “~~~” before and after the error message to make it easier to read.

As for the actual issue, I have a few questions:

  • what version of Duplicati are you using?
  • what encryption options have you chosen (none, default, custom, etc.)?

Hi @JonMikelV,

Thank you!
I downloaded the newest version (Debian Ubuntu (I use Ubuntu 16.10).
And I chose the default encryption.


Unfortunately I’m not that strong with the encryption OR Linux side of things so we may have to reach out to @kenkendk but my guess is there’s an assumed “standard” encryption module missing from your Ubuntu installation.

Am I correct in assuming this is your first backup and it hasn’t run successfully at all yet?

Thank you @JonMikelV for reaching @kenkendk! Yes, I was not able to backup at all.

You’re welcome. Until kenkendk (or somebody else) has another suggestion, do you think you could make a 2nd test backup job going to B2 (or the SFTP server) with no encryption and try backing up a single unimportant file? (Maybe even make a junk text file that you wouldn’t care if somebody in the internet could see.)

If that works, then we at least know the issue is actually in the cryptography part of the code and not somewhere else but being exposed in cryptography. It’s not common, but it’s possible this can happen.

When I choose
General backup settings: Encryption: No encryption
than test the connection to B2 could I got this error message:
"Failed to connect: 401 - bad_auth_token: Invalid authorization token"
And if I try to backup:
“Error while running XXX
Unsupported removal of passphrase”

When I try the same “No encryption” setting to the STP server, the connection is ok, but when I run the backup it gives me the same error message:
“Error while running XXX
Unsupported removal of passphrase”

It sounds like you might be trying to remove encryption from the existing backup - is that what you’re doing or did you create a new backup for this test?