diff --git a/src/KeyConnector/Services/CryptoService.cs b/src/KeyConnector/Services/CryptoService.cs index 7c843e8..35367cb 100644 --- a/src/KeyConnector/Services/CryptoService.cs +++ b/src/KeyConnector/Services/CryptoService.cs @@ -108,7 +108,13 @@ namespace Bit.KeyConnector.Services else { var newSymmetricKey = await _cryptoFunctionService.GetRandomBytesAsync(32); - var decodedEncKey = await RsaEncryptAsync(_symmetricKey); + var decodedEncKey = await RsaEncryptAsync(newSymmetricKey); + + if (decodedEncKey == null) + { + throw new Exception("RSA encryption failed. Your RSA key may not be configured properly."); + } + encKey = Convert.ToBase64String(decodedEncKey); await _applicationDataRepository.UpdateSymmetricKeyAsync(encKey);