Migrate existing key container for strong naming - assemblies

How can I migrate a key container from one machine to another?
I have a key container on an old machine that is used for strong naming assemblies.
Currently I am in the process of migrating the project to a newer machine.
Unfortunately the key container on the old machine is marked as non-exportable, but I managed to export it using mimikatz.
The result was a PVK file (private key), that I converted to an XML file (RSAKeyValue) using the Chilkat library.
The xml file could then be imported to a key container on the new machine using aspnet_regiis.
However, when building the project on the new machine, I get this Linker error:
LINK : fatal error LNK1256: ALINK operation failed (80040405) : The
key container name '...' does not exist
I noticed that there's a difference between key containers that are created with aspnet_regiis and sn.exe.
Key containers generated with sn.exe can be found by the Linker, but key containers generated with aspnet_regiis are not found (LNK1256 error from above).
But in order to install the same key container with sn.exe, it needs to be a .snk file, which I didn't manage to convert yet.
If I can convert it to a .snk file, it doesn't necessarily have to be imported to a key container, because I could use the strong name key file for signing as well.

Related

Firebase Deploy Error: 'Changing secrets is not supported' when using separate projects with Stripe 'Run Payments with Stripe' extension

I'm trying to setup multiple environments for my Vue / Firebase Project.
I have two Firebase Projects
1.) Dev
2.) Prod
The project utilizes Stripe Extension which pulls the API Key from an auto-generated file called:
firestore-stripe-payments.env
which contains:
STRIPE_API_KEY=projects/${param:PROJECT_NUMBER}/secrets/firestore-stripe-payments-STRIPE_API_KEY-xxxx/versions/latest
Where xxxx is a random 4 character string.
That line pulls the value of the key from Google Secret Manager.
Let's say Dev is 'dddd'
and Prod is: 'pppp'
The issue is that I can only define either:
firestore-stripe-payments-STRIPE_API_KEY-dddd
or
firestore-stripe-payments-STRIPE_API_KEY-pppp
At first I tried to create a new value within Google Secret Manager simply called:
firestore-stripe-payments-STRIPE_API_KEY
The thought was this should be a simple fix, and it would pull the associated API_KEY for the project currently being used.
but this causes the error:
Error: firestore-stripe-payments: Found 'projects/foo/secrets/firestore-stripe-payments-STRIPE_API_KEY/versions/latest' for secret param STRIPE_API_KEY, but this instance was previously using a different secret projects/fooo/secrets/firestore-stripe-payments-STRIPE_API_KEY-dddd.
Changing secrets is not supported. If you want to change the value of this secret, use a new version of projects/foo/secrets/firestore-stripe-payments-STRIPE_API_KEY-dddd.You can create a new version at https://console.cloud.google.com/security/secret-manager?project=fooo
Also, if there is a better place to ask this question please let me know, couldn't find the 'right' room
For this scenario, could you include a separate env (env.dev) file using the following guidelines
.env # loaded in all cases
.env.local # loaded in all cases, ignored by git
.env.[mode] # only loaded in specified mode
.env.[mode].local
For generating separate keys for each environment, I believe from your example you are using a single Stripe Extension on a single project.
Firebase Extensions can support multiple instances of an Extension per project, this will create a separate "dev" secret for you to use.
Additionally, a separate Firebase project with another "Stripe Extension" installation would be recommended to separate any concerns in development.

Where does BizTalk keep dlls?

I am having some trouble with BizTalk saying a schema doesn't exist when it does exist.
I can see it in the BizTalkMgmtDb using
select * from bt_documentspec where msgtype like '%myschema%'
I can see it in the BizTalk Server Administration Console > <All Artifacts> > Schemas > My Schema.
This paragraph is optional. I'm only including it so you know I already tried the answer you get when you google this problem.
The exact error message I get is something like "This Assembler cannot retrieve a document specification using this type" which if you google that tells you the schema is either not deployed or the root element you're using exists in two separate namespaces so you should supply a DocSpecName on the SendPorts XMLTransmit 1 2.
I've also tried reinstalling the dll that contains the problem schema into the GAC as per the answer to this question. That didn't work either but now I have more questions anyways.
if I do gacutil -l none of my assemblies are listed there.
So I was wondering what does this even do?
Because those assemblies are not listed under gacutil -l. Also when you look at those assemblies
it shows a source location and a destination location.
Why? Why not just THE location? I can't even find %BTAD_InstallDir% on my computer so there are a minimum of 4 possible locations where this schema dll might be.
source location
destination location (%BTAD_InstallDir%)
"the GAC"
wherever it actually is because there doesn't seem to be a %BTAD_InstallDir%.
So if I want to "update the GAC" to make sure this schema is there how do I do that? What dll is BizTalk ACTUALLY using? The one in %BTAD_InstallDir% or the one in the GAC?
BizTalk 2010.
It has nothing to do with where the DLL is, it has to do with the fact that either
The XML payload namespace and root node does not match any schema
You have two or more schemas with exactly the same namespace and root node that match.
If you don't have any namespace on the XML, then it will try and match on Root node only, but again if you have more than one schema with the same root node, it will fail.
What you need to do is look at the suspended message and look at it's context properties and see what it's Message Type is, and compare that against the schema in BizTalk. There should be exactly one that matches.
vs
But to answer your question,
The source location is usually just the path of where the DLL was when it was initially imported in Dev.
the %BTAD_InstallDir% is the directory you chose when importing a MSI, the default location is C:\Program Files (x86)\Generated by BizTalk. However that is just where it puts it initially
Yes, in the end the actual one it uses will be in the GAC, which is under C:\Windows\Microsoft.NET\assembly\GAC_MSIL
Note: If the DLL has been previously been deployed and you are deploying a new one then make sure you restart the host instances afterwards, as it will cache DLLs in memory for a period.

Qt - Auto detection of a file in application folder

I have a sqlite database of my Qt C++ application. Suppose I located it on my default build/release folder and I also placed the database file on that same folder. I have login.h and login.cpp. I want that the application may auto detect the database and open it. I will only provide the name of database (Ex: mydb.sqlite).
Database.addDatabase("QSQLITE");
Database.setDatabaseName("I will only provide database file name here.like: mydb.sqlite");
I want that the rest of the directory should automatically detected and the database connection works perfectly.
Suppose, I have the sqlite file in:
C:/Qt/build-myapp-mingw-32/mydb.sqlite.
I am taking a string variable called path. And I want that, the application automatically detect the whole path. And open the database connection.
You do not have to give the complete path to database to make it works.
You can refer to the path from your build dir or maybe use :
QCoreApplication::applicationDirPath();
To get the path of your app and then navigate through your directories with .. ?

MyGeneration.dOOdads problem with MySQL connection in ASP.net with stored procedures

I am using MyGeneration.dOOdads which helps in generating Business layer and Data layer easily, but currently I am facing a problem with it.
I had worked with MS SQL database and was successful, but now I have to work with MySQL 5.
I have the generated data layer classes of MySQL database successfully, but when I add them in my project along with the reference of MyGeneration.dOOdads dll file it gives error of no MySql4Entity class in the namespace.
I have generated the class according to the given instructions and also added the reference of mysql.data in the project but still this error is occuring.
Please guide me if you have used MyGeneration.doodads for MYSQL5 database in asp.net.
Also please tell me how to make stored procedure using MyGeneration.doodads of MYSQL database?
open doodads project (source code) .. right click on MySql4Entity class (and other classes related to mysql) and choose 'properties' the choose build action as 'compile' from the list ... to compile the file then build the project and it its output as reference to your project ...

Finding the File Version of a COM DLL using ASP.NET

I have a software diagnostic page on which I would like to list the File Version information of a couple of COM DLLs. The page is running under the normal, restricted ASP.Net account (NETWORK SERVICE).
Given the ProgIDs of a COM library, what's the best way to go about getting the physical file path or otherwise accessing the file version #?
Note that loading it via Type.GetTypeFromProgID and using the type's Assembly object won't work, as the Assembly object returned is the one for mscorlib.
The install path can be selected by the user and is not guaranteed to be a specific value.
One way of approaching this is to use the COM function CLSIDFromProgID (Pinvoke.Net shows how to call this from .Net here) to obtain a CLSID, use the GUID.ToString("B") to convert the CLSID to a suitably formatted string then use it to go grovelling in the registry to find where the COM server is registered.
The path will be
HKEY_CLASSES_ROOT\CLSID\<YourCLSID>\InprocServer32 if the COM server is an in-process server (i.e. a DLL as you're expecting)
Note that the file path in the registry is not necessarily a fully qualified path.

Resources