Archive

Archive for the ‘Programming’ Category

Signing a Java JAR file with a Microsoft Authenticode Code Signing Certificate

March 1, 2014 Comments off

You already have a Microsoft Authenticode code signing certificate from Verisign/Symantec
and now you want to sign Java JAR files.  Can you re-use your Microsoft Authenticode certificate?  As of this writing, Yes.

If you do not already have your current Authenticate code signing certificate exported as a .pfx file, then export your certificate and private key from your Windows Certificate Manager:

  1. Start->Run: certmgr.msc
  2. Select your existing Code Signing Certificate.
  3. Right-click:  All Tasks -> Export …
  4. Welcome Screen: Next>
  5. Export Private Key: Yes, export the private key.  Next>
  6. Export File Format: Personal Information Exchange -PKCS #12(.PFX)
    • Yes: Include all certificates in the certification path if possible.
    • No: Delete the private key if the export is successful.
    • Yes: Export all extended properties.
    • Next>
  7. Password:  Specify a strong password.  Next>
  8. File to Export: Specify a file path for exporting your certificate.  Next>
  9. Completing the Certificate Export Wizard:  Finish
  10. You should now have your .pfx file.

To sign your JAR file:

  1. Retrieve the Alias Name from your .pfx file:
    "C:\Program Files\Java\jdk1.7.0_51\bin\keytool.exe" -list 
        -storetype pkcs12 -keystore mycertificate.pfx -v

    Near the top of the output, locate the line:

    Alias name: {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}
  2. Sign your JAR files using the .pfx file and the correct alias name:
    "C:\Program Files\Java\jdk1.7.0_51\bin\jarsigner.exe" -storetype pkcs12
        -keystore mycertificate.pfx myjarfile.jar 
        "{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}"
        -tsa https://timestamp.geotrust.com/tsa

    Password: Specify the password that you used when exporting the *.pfx file.

  3. Verify the signature:
    "C:\Program Files\Java\jdk1.7.0_51\bin\jarsigner.exe" -verify 
        -verbose -certs myjarfile.jar

References:

Categories: Programming, Windows

Windows: Removing a Plug and Play driver from the driver store.

November 21, 2011 Comments off

When an OEM kernel driver is installed in Windows, driver files are typically installed to the following locations:

  • \Windows\inf\ – the .inf file is renamed to oem#.inf
  • \Windows\System32\drivers\

To remove a particular .inf file and related files, see the following article:

On Vista and later, the driver is also added to the Windows Driver Store located in:

  • \Windows\System32\DriverStore

The oem.inf filename for a particular driver can be found by enumerating all of the OEM drivers in the Driver Store.

To enumerate the plug-and-play drivers, from a Windows cmd prompt opened in administrator mode, run:

  • pnputil.exe –e

To remove a particular OEM driver from the driver store use:

  • pnputil.exe -d oem#.inf

Reference:

Categories: Programming, Windows

Link: Optimizing software in C++

September 24, 2011 Comments off

A set of articles related to software optimization:
http://www.agner.org/optimize/
Particularly relevant is the article on C++ optimization:
http://www.agner.org/optimize/optimizing_cpp.pdf

These links were recently highlighted in Microsoft’s MSDN enews.  Interestingly enough, for obvious reasons, the C++ optimization article is pretty clear in recommending that you avoid .NET and Java for anything requiring performance.

Categories: Programming

RFC 1925 – The Twelve Networking Truths

September 23, 2010 Comments off

A classic, from April 1996, RFC 1925 – The Twelve Networking Truths.

My favorites:

   (5)  It is always possible to aglutenate multiple separate problems
        into a single complex interdependent solution. In most cases
        this is a bad idea.

and

   (12) In protocol design, perfection has been reached not when there
        is nothing left to add, but when there is nothing left to take
        away.

 

Reference:

Categories: Programming

Windows – Loading a 64-bit crash .dmp for a 32-bit application

September 20, 2010 Comments off

If a crash dump shows WOW64 CPU emulation in all threads (e.g.  wow64cpu.dll!CpuSysCallStub() …) then a 64-bit dump has been generated for a 32-bit process.

To view the stack the wow 64-bit extensions need to be loaded first into Windbg:

In Windbg:

0:000> .load wow64exts
0:000> .effmach x86
Effective machine: x86 compatible (x86)
0:000:x86> !analyze -v

Reference:

Categories: Programming, Windows

A Crash Course in Modern Hardware

January 21, 2010 Comments off

A facinating overview of pipelining and multi-core caching issues.  “A Crash Course in Modern Hardware” by Dr. Cliff Click.

You really have no idea what the CPU is going to do with your code until you’ve run it.

Reference:

facinating

Categories: Programming

Google’s C++ Style Guide

January 7, 2010 Comments off

When using a computer language, I find it interesting that it is as important to know what language features to use as it is to know what language features not to use.

Looking through Google’s C++ style guide a while back it struck me that programmers eventually arrive at a similar set of features to avoid in a language; however, it takes trial and error to figure out to avoid.

In C++, exceptions and particularly templates look inviting, until you have tripped a few times over the problems that they introduce.

Reference:

Categories: Programming