Error installing Server - [Cryptography] Specified key is not a valid size for this algorithm

Virtual Server:
Windows Server 2016 Datacenter
Inel Xeon E5-2680 v4 @ 2.40GHz
16.0 GB RAM
64-bit OS, x64-based processor

Is there a fix or workaround for the below error?

I try installing the server application and i get the following error in the Log:

Saving instance: OctopusServer
Setting home directory to: E:\Applications\Octopus
Setting server node name to ‘DEVSERVICES’.
Setting database connection string to: data source=testsql;initial catalog=OctopusDeploy;integrated security=True
========== SQL Database Connection Details ========
SQL Server: testsql
SQL Database: OctopusDeploy
Authentication Type: Windows Integrated Security
User: USSYNTHETIC\11016409

===================================================
Testing connection to the ‘master’ database…
Successfully connected to ‘master’ database!
Database ‘OctopusDeploy’ already exists on SQL Server at ‘testsql’, no need to create it.
Processing user account ‘USSYNTHETIC\11016409’…
Adding ‘USSYNTHETIC\11016409’ as a member of the ‘db_owner’ role…
Ensuring the database principal mapped to USSYNTHETIC\11016409 belongs to the role db_owner…
Checking the Octopus Master Key has been configured.
Making sure it’s safe to upgrade the database schema…
Ensuring pre-conditions for upgrading the database are satisfied…
Searching for indexes that might upset the database upgrade process…

  • PASS: All columns use the default collation.
  • PASS: The Octopus Server is still being configured, there is no need to check for license compliance.
  • PASS: We’ve done our best to remove any unexpected database indexes.
  • PASS: The version of your SQL Server satisfies Octopus Server installation requirements.
    Executing always run pre scripts…
    Executing TSQL Database Server script ‘Octopus.Core.UpgradeScriptsAlwaysPre.Script0000 - Set highest available compatibility level.sql’
    Current COMPATIBILITY_LEVEL for OctopusDeploy is set to 130
    Ensuring COMPATIBILITY_LEVEL for OctopusDeploy is set to 130
    COMPATIBILITY_LEVEL for OctopusDeploy is already 130 or higher
    Checking to see if database schema upgrade is required…
    ====================================================================================
    Database schema changes are required. Execution plan:
    ====================================================================================
    Planned pre-upgrade scripts (non-transactional):
    • Octopus.Core.UpgradeScriptsPre.Script0000 - Database options.sql

Planned schema upgrade scripts (single transaction for all scripts):


Starting database schema upgrade…



Database schema upgrade completed taking 7 seconds

Executing always run post scripts…
Executing TSQL Database Server script ‘Octopus.Core.UpgradeScriptsAlwaysPost.Script0000 - Refresh Views.sql’
Refreshing view dbo.Dashboard
Refreshing view dbo.IdsInUse
Refreshing view dbo.MultiTenancyDashboard
Refreshing view dbo.Release_WithDeploymentProcess
Refreshing view dbo.RunbookSnapshot_WithRunbookProcess
Refreshing view dbo.TenantProject
Creating default maintenance mode configuration
Creating built-in role Project viewer
Creating built-in role Project contributor
Creating built-in role Project lead
Creating built-in role Project deployer
Creating built-in role Project initiator
Creating built-in role Runbook producer
Creating built-in role Runbook consumer
Creating built-in role Environment viewer
Creating built-in role Environment manager
Creating built-in role Package publisher
Creating built-in role Tenant manager
Creating built-in role Certificate manager
Creating built-in role Release creator
Creating built-in role Deployment creator
Creating built-in role Build server
Creating built-in role System manager
Creating built-in role System administrator
Creating default team Octopus Administrators
Creating default team Octopus Managers
Creating default team Everyone
Creating default Octopus Server certificate
Error: ===============================================================================
Error: Specified key is not a valid size for this algorithm.
Error: System.Security.Cryptography.CryptographicException
Error: at System.Security.Cryptography.SymmetricAlgorithm.set_Key(Byte[] value)
Error: at System.Security.Cryptography.AesCryptoServiceProvider.set_Key(Byte[] value)
Error: at Octopus.Core.Security.MasterKey.MasterKeyEncryption.CreateAlgorithm(Byte[] key, Boolean generateSalt) in MasterKeyEncryption.cs:line 32
Error: at Octopus.Core.Security.MasterKey.MasterKeyEncryption.ToCiphertext(Byte[] masterKey, Byte[] plaintext, Boolean generateSalt) in MasterKeyEncryption.cs:line 52
Error: at Octopus.Core.Security.MasterKey.StoredMasterKeyEncryption.ToCiphertext(Byte[] plaintext) in StoredMasterKeyEncryption.cs:line 67
Error: at Octopus.Core.Security.MasterKey.MasterKeyEncryptionExtensions.StringToCiphertext(IMasterKeyEncryption encryption, String plaintext) in MasterKeyEncryptionExtensions.cs:line 14
Error: at Octopus.Core.RelationalStorage.TypeHandlers.SensitiveStringTypeHandler.WriteJson(JsonWriter writer, Object value, JsonSerializer serializer) in SensitiveStringTypeHandler.cs:line 54
Error: at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeConvertable(JsonWriter writer, JsonConverter converter, Object value, JsonContract contract, JsonContainerContract collectionContract, JsonProperty containerProperty)
Error: at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty)
Error: at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
Error: at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty)
Error: at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value, Type objectType)
Error: at Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter jsonWriter, Object value, Type objectType)
Error: at Newtonsoft.Json.JsonSerializer.Serialize(JsonWriter jsonWriter, Object value, Type objectType)
Error: at Newtonsoft.Json.JsonConvert.SerializeObjectInternal(Object value, Type type, JsonSerializer jsonSerializer)
Error: at Newtonsoft.Json.JsonConvert.SerializeObject(Object value, Type type, JsonSerializerSettings settings)
Error: at Newtonsoft.Json.JsonConvert.SerializeObject(Object value, JsonSerializerSettings settings)
Error: at Nevermore.Advanced.Serialization.NewtonsoftDocumentSerializer.SerializeText(Object instance, DocumentMap map)
Error: at Nevermore.Util.DataModificationQueryBuilder.GetDocumentParameters(Func2 allocateId, String customAssignedId, Nullable1 customIdAssignmentBehavior, Object document, DocumentMap mapping, String prefix)
Error: at Nevermore.Util.DataModificationQueryBuilder.GetDocumentParameters(Func2 allocateId, String customAssignedId, IReadOnlyList1 documents, DocumentMap mapping)
Error: at Nevermore.Util.DataModificationQueryBuilder.PrepareInsert(IReadOnlyList1 documents, InsertOptions options) Error: at Nevermore.Advanced.WriteTransaction.Insert[TDocument](TDocument instance, InsertOptions options) Error: at Octopus.Core.RelationalStorage.RawRelationalTransaction.Insert[TDocument](TDocument instance, InsertOptions options) in RawRelationalTransaction.cs:line 142 Error: at Octopus.Core.Initialization.BuiltIn.OctopusCertificateInitializer.Initialize(IRawRelationalStore store) in OctopusCertificateInitializer.cs:line 75 Error: at Octopus.Core.Initialization.StoreInitializer.Initialize() in StoreInitializer.cs:line 22 Error: at Octopus.Server.Commands.DatabaseCommand.Start() in DatabaseCommand.cs:line 203 Error: at Octopus.Shared.Startup.AbstractCommand.Start(String[] commandLineArguments, ICommandRuntime commandRuntime, OptionSet commonOptions) Error: at Octopus.Shared.Startup.OctopusProgram.Start(ICommandRuntime commandRuntime) Error: at Octopus.Shared.Startup.ConsoleHost.Run(Action1 start, Action shutdown)
Error: at Octopus.Shared.Startup.OctopusProgram.RunHost(ICommandHost host)
Error: at Octopus.Shared.Startup.OctopusProgram.Run()
Error: -------------------------------------------------------------------------------
Error: Terminating process with exit code 100
Error: Full error details are available in the log files at:
Error: C:\Users\11016409\AppData\Local\Octopus\Logs
Error: E:\Applications\Octopus\Logs
Error: If you need help, please send these log files to Octopus Deploy Help & Support - Octopus Deploy
Error: -------------------------------------------------------------------------------
Error:
Error: The previous command returned a non-zero exit code of: 100
Error: The command that failed was: “C:\Program Files\Octopus Deploy\Octopus\Octopus.Server.exe” database --instance “OctopusServer” --connectionString “Data Source=testsql;Initial Catalog=OctopusDeploy;Integrated Security=True” --create --grant “USSYNTHETIC\11016409”
Deregistered OctopusServer from the database.
Deleted instance: OctopusServer

Hi Carlin,

Thanks for getting in touch! From the error, it looks like Octopus may be having trouble processing provided master key during the installation.

Would you be able to confirm that the master key entered is free from any white space or unintended characters?

I believe we often see this error when supplying too many characters for the master key during the installation.

Let me know if you continue to see this error after confirming the master key being entered is correct.

Best regards,
Daniel

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