Problems after migrating ContinuaCI to another Server (and PostgreSQL-Server)

Hi there,

my old CI-server was running on Windows 10 with a local postgres db. I am in the process of migrating it to a new Windows 10 machine and have it connected to a dedicated postgres instance.

I stumbled over two problems:

User Logins do not work anymore. I could circumvent that by letting CI-Server settup another empty postgres instance, created the same user with the same password and copied the password hash over with a postgres-db tool. After that I could login again and the dashboard shows the project to compile. But …

When I click a project I get 'An unexpected error occured: Padding is invalid and cannot be removed.'

I checked the windows events and found the following exception:

An error occurred while resolving project with name '<projectname>'. Details: Exception: CryptographicException

Message: Padding is invalid and cannot be removed.

Stack Trace:    at System.Security.Cryptography.RijndaelManagedTransform.DecryptData(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount, Byte[]& outputBuffer, Int32 outputOffset, PaddingMode paddingMode, Boolean fLast)
   at System.Security.Cryptography.RijndaelManagedTransform.TransformFinalBlock(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount)
   at Continua.Shared.Extensions.StringExtensionsUtils.Decrypt(String value)
   at Continua.Shared.Variables.VariableDTOMappings.<>c.<ConfigureVariables>b__0_0(Variable v, VariableDTO dto)
   at Continua.Shared.Mapping`2.Map(TSource source, TDestination destination)
   at Continua.Shared.Mapping`2.Map(TSource source)
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at Continua.Shared.Mapping`2.Map(IEnumerable`1 sources)
   at Continua.Services.DataTransferObjects.CoreDTOMappings.<>c.<Configure>b__0_0(Project p, ProjectDTO dto)
   at Continua.Shared.Mapping`2.Map(TSource source, TDestination destination)
   at Continua.Shared.Mapping`2.Map(TSource source)
   at Continua.Shared.Mapping`2.Map(TSource source, Action`2 modifier)
   at Continua.Services.CoreService.ResolveProject(String name)

I googled and found this:
https://stackoverflow.com/questions/8583112/padding-is-invalid-and-cannot-be-removed
Could it be that there is simply a Trim missing before decryption?

This cryptographic exception seems related to the one I got in the old buildserver after installing all windows updates. CI-Server refused to start with a Cryptographic Exception complaining about a temporary user not having enough priviliges.

Some more info: My postgres server is now running under debian. The only thing I adjusted in the dumpfile in order to import it was LC_Collate and LC_CTYPE:

From:

CREATE DATABASE "ContinuaCI" WITH TEMPLATE = template0 ENCODING = 'UTF8' LC_COLLATE = 'English_United States.1252' LC_CTYPE = 'English_United States.1252';

To:

> CREATE DATABASE "ContinuaCI" WITH TEMPLATE = template0 ENCODING = 'UTF8' LC_COLLATE = 'en_US.UTF-8' LC_CTYPE = 'en_US.UTF-8';

Hi Christian,

This error occurs when attempting to decrypt an encrypted string using the wrong encryption key. The encryption keys are stored in the <appSettings> section of server configuration file:

 <add key="Continua.HashSalt" value="***"/> 
 <add key="Continua.SymmetricEncryptionKey" value="***"/>
 <add key="Continua.SymmetricEncryptionVector" value="***"/>

When migrating ensure that these keys are copied from the old server to the new server.

The sever configuration file is located at <continua_install_path>\Server\Continua.Server.Service.config. By default, this is at %ProgramFiles%\VSoft Technologies\ContinuaCI\Server

Note that this file also contains the connection string for the database.

Thank you very much!