Showing posts with label deployment. Show all posts
Showing posts with label deployment. Show all posts

Sunday, 3 July 2016

Issues in Signing a .NET Assembly using .pfx file

Problem:

I have procured a code signing certificate with a view to ensure that one of application that we intend to distribute to external users is signed so that the same can be trusted by the end users. I imported the certificate into the certificate store and used it successfully to sign the Click Once Manifest using the Signing tab in the Projec Properties dialog in Visual Studio 2013. But I could not have the assembly signed. I exported the certificate from the store as a .pfx file and tried using it for signing the assembly, but am getting issues like "Private Key not Found", while the Private key is very much present in the .pfx file.

By: Rajkumar David

Solution:

Visual Studio 2013 has known issues in handling PKCS# 12 certificate files as it cannot handle files with multilpe certificates in the CA certificate chain. Visual studio may not still consider such certificates for signing the assembly because of the KeySpec Parameter, which is usually set as AT_KEYEXCHANGE(1), whereas Visual Studio expects this to be AT_SIGNATURE(2). It is possible that while requesting the certificate, the KeySpec is set as 1 and as such the certificate is generated with the value as 1. You may verify CSR that you have submitted to the CA to check this.

OK, now what do you with that certificate? You have option to import such certificates with KeySpec set as AT_SIGNATUR. The Windows Servers from 2003 onwards have a commandline certificate import utility - certutil.exe. This command allows you to import the certificate with the right KeySpec parameter. Use the following command to do this:

certutil -importPFX -user <pfxfilename> AT_SIGNATURE

After importing the certificate using the above command into the certificate store and then export it back as .pfx file from the store for assembly signing within Visual Studio. This should resolve the given problem.

More on the CertUtil command can be found here.

Saturday, 26 April 2014

Start PXE Over IPv4

Question:

My six months old HP Laptop which was working fine all along, once did not boot and I could see the text "Start PXE over IPv4" in the black MS DOS like screen and was unresponsive to keyboard and mouse. I waited for some time and then used the power button to hard shut down and then powered it again. This time it booted normally without any issues. Though the problem did occur thereafter, I am curious to know what PXE is all about. Can you explain what it is and the reason for it showing up?

By: Anonymous

Answer:

PXE is the short form for Preboot Execution Environment.It allows PCs or laptops to boot over a network as against booting from the local hard disk. Those who have worked with Novell Netware should be familiar with this network booting, where the Network Interface Cards carry a small add on chip containing the Network Boot Program, which will perform the boot over the network.

To address the large deployment challenges, Microsoft began developing the technology that would allow for network-based installation and PXE was the solution for this. To PXE boot a PC, the BIOS should be setup to boot from network. When set so, the BIOS will first get an IP address for the PC from the PXE Server and thereafter to get the boot image using TFTP on to the RAM and then boot out of that image.

Now in your case, as you have described the issue, it just happened, without you changing any BIOS setting. Normally the BIOS have multiple boot options configured with an order of priority. Your BIOS probably had the Network boot as one of the boot options and on that occasion, for some reason, your hard drive would have been unresponsive for a moment at the time of boot, as the next choice, the BIOS would have attempted to boot from network using PXE. As it might not find a PXE server over the IPv4 network it stayed there. 

You can check the BIOS by pressing F2 when your laptop boots and check if the network boot is configured as an option. You may disable this option, if you are not using the Network booting in your environment. On a different note, you may want to check why your local hard disk was not responsive for the boot on that occasion. That could be an odd occurrence and  the disk may be just fine too.

To know more about PXE booting, check the following resources: