Do not take an RSA private key if the storage wasn't RSA encrypted.

This commit is contained in:
Gilbert Chen
2020-03-11 23:14:01 -04:00
parent b61906c99e
commit 733b68be2c

View File

@@ -588,6 +588,11 @@ func (config *Config) loadRSAPublicKey(keyFile string) {
// loadRSAPrivateKey loads the specifed private key file for decrypting file chunks // loadRSAPrivateKey loads the specifed private key file for decrypting file chunks
func (config *Config) loadRSAPrivateKey(keyFile string, passphrase string) { func (config *Config) loadRSAPrivateKey(keyFile string, passphrase string) {
if config.rsaPublicKey == nil {
LOG_ERROR("RSA_PUBLIC", "The storage was not encrypted by an RSA key")
return
}
encodedKey, err := ioutil.ReadFile(keyFile) encodedKey, err := ioutil.ReadFile(keyFile)
if err != nil { if err != nil {
LOG_ERROR("RSA_PRIVATE", "Failed to read the private key file: %v", err) LOG_ERROR("RSA_PRIVATE", "Failed to read the private key file: %v", err)