1

I have C# application (targeting .NET Framework) and I try to set a password on my (completely new) SQLite database.

This is my code

using System;
using System.Data.SQLite;

namespace ConsoleApp10
{
    internal class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Begin");
            var csWithoutPw = new SQLiteConnectionStringBuilder
            {
                DataSource = "C:\\Databases\\SQLiteWithEFPw.db",
                Version = 3
            }.ConnectionString;
            SQLiteConnection conn = new System.Data.SQLite.SQLiteConnection(csWithoutPw);
            
            conn.Open();
            conn.ChangePassword("Kabouter");
            conn.Close();

            Console.WriteLine("End");
        }
    }
}

This is my csproj:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net462</TargetFramework>
  </PropertyGroup>


    <ItemGroup>
        <PackageReference Include="SQLite" Version="3.13.0" />
        <PackageReference Include="Stub.System.Data.SQLite.SEE" Version="1.0.115.6" />
        <PackageReference Include="System.Data.SQLite" Version="1.0.115.5" />
        <PackageReference Include="System.Data.SQLite.Linq" Version="1.0.115.5" />
    </ItemGroup>

</Project>

Unfortunately, my code crashes when connecting with a NotSupportedException referring to some certificate issue I do not understand.

'{cannot find a suitable package certificate file for plugin in "C:\Users\dacohen\source\repos\ConsoleApp10\ConsoleApp10\bin\Debug\net462\SDS-SEE.exml" : "invalid file name"} {}'

How can I avoid this problem? I just want to set the password..... I found code online but for .NET Framwork 4.6.2 it does not seem to work or so.

enter image description here

In addition, this is why I set my password before opening.

enter image description here

Daan
  • 2,478
  • 3
  • 36
  • 76
  • 3
    Do you have a license for the [SEE](https://www.sqlite.org/see/doc/release/www/sds-nuget.wiki) extension? That is required. – Mark Benningfield Jan 27 '22 at 16:30
  • @MarkBenningfield No. Is this the same as "A perpetual source code license for the SQLite Encryption Extension (SEE) " https://sqlite.org/purchase/see ? Or is this a different license? How can I get it. – Daan Jan 27 '22 at 16:50
  • 2
    No, that's the one. Your link has all the details about obtaining one. – Mark Benningfield Jan 27 '22 at 16:51

0 Answers0