Click here to learn
about this Sponsor:
Home  |  News  |  Articles  |  Polls  |  Forum  |  Directory

Keywords: Match:
Security Catalogs and Windows XP Embedded
by Alex Gimenez (July 16, 2007)

Foreword: Security Catalogs are an important feature of the Windows security system because they help reduce disk footprint used by the code signing process. Security catalogs are installed differently on Windows XP Embedded systems than on desktop systems. This article explains those differences, and how they impact XP Embedded images.



Security Catalogs and Windows XP Embedded

by Alex Gimenez


Terminology and Concepts

A few terms need to be defined for the purposes of this discussion:
  • Code Signature -- A hash generated for an entire binary file (an EXE, DLL, or others). The hash is encrypted with a private key, and it can be decrypted with a public key which is included in the signature via a certificate. Code signatures can be embedded in the signed binary, or they can be stored separately, in a security catalog. These hashes are produced during the code signing process, and they are used by the OS to authenticate the signature for those binaries. That "authentication" process is also referred to as the "client side" of the code signing process.

  • Security Catalog -- a security catalog is a signed file containing a list of code signatures (or hashes) and a set of attributes for a number of binary files.

  • Certificate Chain -- A set of related certificates starting with the certificate that can be used to decrypt the encrypted hash and including its issuer and all the higher-level issuers all the way up to a trusted root authority (a self-signed certificate the user has chosen to trust). These certificates, excluding the trusted root authority, are typically stored along with the hashes.
To validate a code signature, the OS decrypts the hash using the signer's public key included in the signature, and then re-calculates the hash (by reading the relevant parts of the signed binary) to verify that the re-calculated value matches the one decrypted. This step validates the integrity of the file (i.e. that is hasn't been altered). Next, the OS validates that the signer is a trusted entity and that it's entitled to sign code through validation of the signer's certificate (this process requires a certificate chain).

The problem that Security Catalogs solve

Initially, code signatures could only be embedded in the signed binaries. That required too much footprint in an OS that had thousands of binaries. Much of the information in the signatures is not unique -- namely, the certificate chains. And they would be the exact same certificate chains stored in every binary. Security catalogs store hashes for multiple binaries, and a single copy of the certificate chain, therefore saving a lot of footprint.

Catalog Databases and multiple hashes

The usage of security catalogs expose yet another problem, which is solved with Catalog Databases:
  • One file's hash can be present in multiple security catalogs;

  • When you install a particular binary, you may want to ensure that the hash used to validate it comes from a particular security catalog – your security catalog;
A catalog database keeps a mapping of all hashes to the catalog file they came from, and to the binary they sign. Programs can inquire for all catalogs that contain a hash for, say, foo.dll, and then pick the hash that comes from the right catalog. This saves application programs from having to read every catalog in the system looking for the right hash.

Given this, you can infer that a catalog database can be re-generated at any time by reading the original catalogs they were generated from.

Catalogs on a Desktop System ("Stop Babbling Theory! Show me something practical!")

Security catalogs are stored in ".cat" files, which are stored at %WINDIR%\system32\catroot. The catalog database is present at %WINDIR%\system32\catroot2. The official way for these files to get there is for them to be installed via the CryptCATAdminAddCatalog API. That API copies the .cat files over to their rightful place under "catroot", and it also updates the catalog database to reflect the addition of all new hashes.

Where XPe fits in ("at last!")

Code signing is disabled for most Windows XP Embedded components. The components that do require code signing, such as Windows Media Player, are authored to directly copy files into %WINDIR%\system32\catroot. This leaves the database in an inconsistent state (i.e., there are .cat files in "catroot" which are not present in the database, in "catroot2"). So how can code signing work on an XPe image? The answer is that the APIs that read security catalogs are made to detect that inconsistency, and rebuild the security catalog when they see such inconsistency. So what actually happens the first time XPe validates a signature is:
  • It tries to get the location of the hash from the database -- that fails;

  • It rebuilds the security catalog.

  • It tries again -- this time it will succeed, assuming all the correct ".cat" files were stored where they belong.
You can also force a rebuild of the catalog database, with the following command:
    del /q "%SystemRoot%\System32\Catroot2\Edb.log
Knowing that this takes place helps you understand why these files are there and what their purpose is. It also helps you optimize your image's first-time use -- you can try to force a rebuild of the catalog databases before first-time use, thus making your application more responsive in its first use.

Note that copying catalogs directly to "catroot" is a shortcut to simplify FBA on XPe, and make FBA independent of some security components. Should you use code signing in your applications, consider using the official catalog installation method (CryptCATAdminAddCatalog) on an existing catalog database.

Conclusion

Code signing is an interesting area of the OS that is handled differently in Windows Embedded (as compared to the Desktop). Understanding those differences can help you optimize your device's first-time use. Understanding code signing in general can help you plan security features for your application.


Copyright (c) 2007 Microsoft Corp. All rights reserved. Reproduced by WindowsForDevices.com with permission. This article was originally published on the Windows XP Embedded team blog, here.



About the author: Alex Gimenez spent a decade as a software developer before joining Microsoft where he spent three years in Test working with some "cool automation" for Live Meeting. He joined the Embedded Windows team as a developer late last year. Although originally from Brazil, "I can't play soccer to save my life," says Gimenez.



Related stories:

(Click here for further information)


Windows XP for Embedded Applications
This white paper describes the benefits of using Windows XP when developing embedded applications.

A Manager's Guide to Selecting a Mobile Device Operating System
This white paper offers a comparative review of Microsoft Windows CE and Windows Mobile.

Visual Basic 6.0 to .NET Migration
This paper focuses on the methodology and techniques which Infosys (Microsoft Technology Center) has developed for migrating VB 6.0 Applications to .NET. Our approach ensures a smooth, cost effective, and efficient migration.

Mobile Device Security: Securing the Handheld, Securing the Enterprise
This whitepaper identifies security threats to corporate data on mobile devices and details how mobile devices can become a "backdoor" to the enterprise.

Mobile Device Security: The Eight Areas of Risk
It's common knowledge that adding mobile devices to your network increases security risks. There are multiple facets to mobile security, all of which should be paid close attention to. This E-Guide presents a more in depth look into the eight key areas of securing wireless devices.

Quality Assurance and .NET
This paper discusses best practices for functional, regression and load testing of .NET applications.

SCADA Security in Integrated Networks
As businesses leverage their SCADA systems by integrating them into the business networks, they must also assure the security of the SCADA system.

The Advantages of Small Form Factor HMI
HMIs have mutated and changed with new requirements, and they have become more flexible and capable. And while they've been doing that, they've become smaller and more useful.

9 Critical Requirements for Web Application Security
Learn why your Web applications expose dangerous security breaches and what’s required to effectively protect your Web applications and the sensitive information behind them.

 


Got a HOT tip?   please tell us!
Free weekly newsletter
Enter your email...
Click here for a profile of each sponsor:
PLATINUM SPONSORS
(Become a sponsor)

ADVERTISEMENT
(Advertise here)


Updated! The latest Windows-powered...

mobile phones!

other cool
gadgets

HOT TOPICS
Microsoft targets PNDs with new embedded OS
Microsoft tips .NET MF 3.0 highlights
Microsoft previews Windows Embedded Standard
Microsoft offers free Windows CE 6.0 textbook
Microsoft renames embedded operating systems
Microsoft unveils Windows Mobile 6.1
New Atom models target low-cost PCs
REFERENCE GUIDES
Windows Device Showcase
Intro to Windows Embedded
Intro to Shared Source
Real-time Windows Embedded
Windows Embedded books
Join our Windows Embedded discussion forums:
Windows XP Embedded
Windows CE
Windows Mobile


Windows Embedded developer newsgroups
Windows CE
XP Embedded
PocketPC
Smartphone

Microsoft's Windows Embedded resources
Embedded dev center
Mobile dev center
Windows CE tutorials
XP Embedded tutorials
Windows Embedded seminars
Windows Embedded application categories
3rd-party partners


BREAKING NEWS

• Superscalar ARM SoC runs Windows CE
• CE-based nav stack heads for CES
• Windows phone has dual displays
• Cortex-A8 SoC targets netbooks
• Palm "Nova" Linux set for CES debut?
• Editors' retrospective -- Windows-powered Devices in 2008
• Firefox mobile browser alphas released
• Box PC doubles as car computer
• Windows phone has dual active radios
• Windows PMP has dual-core CPU
• COM Express module sports Atom
• "Half-rack" network appliance runs Windows
• Cross-platform NAS runs Windows
• ARM to dominate MIDs?
• Toshiba launches first 512GB SSD


MOST POPULAR (last 90 days)
• "Netbook" uses Intel's Atom N270
• Windows CE takes on Linux in low-end netbooks
• HTC ups Touch resolution
• Microsoft unleashes new embedded OS
• Windows Mobile phone gets 800 x 480 display
• HTC spins WiMAX phone?
• Smart camera sports Atom
• Dual-core AMD netbook gets rave review
• Windows Mobile 7 "delayed"
• GPS phone uses new Marvell "Tavor" chip
MOST POPULAR (Classics from the vault)
Windows XP Embedded USB boot
Troubleshooting Windows XPe's blue screen "Stop 0x0000007B" error
Asus reveals $190 mini notebook
Windows Mobile 6 SDKs available for download
Windows Mobile VPN client plays with Cisco
HTC adds GPS to Windows Mobile Touch line
Microsoft unveils Windows Mobile 6.1
Guide to HTC's Windows Mobile smartphone platforms
• HTC releases Touch Diamond ROM upgrade
Customizing Windows XP Embedded thin clients

Also visit our sister sites:


Sign up for WindowsForDevices.com's...

news feed

Home  |  News  |  Articles  |  Polls  |  Forum  |  Directory  |  About  |  Contact
 

Ziff Davis Enterprise Home | Contact Us | Advertise | Link to Us | Reprints | Magazine Subscriptions | Newsletters
Tech RSS Feeds | White Papers | ROI Calculators | Tech Podcasts | Tech Video | VARs | Channel News

Baseline | Careers | Channel Insider | CIO Insight | DesktopLinux | DeviceForge | DevSource | eSeminars |
eWEEK | Enterprise Network Security | LinuxDevices | Linux Watch | Microsoft Watch | Mid-market | Networking | PDF Zone |
Publish | Security IT Hub | Strategic Partner | Web Buyer's Guide | Windows for Devices

Developer Shed | Dev Shed | ASP Free | Dev Articles | Dev Hardware | SEO Chat | Tutorialized | Scripts |
Code Walkers | Web Hosters | Dev Mechanic | Dev Archives | igrep

Use of this site is governed by our Terms of Service and Privacy Policy. Except where otherwise specified, the contents of this site are copyright © 1999-2008 Ziff Davis Enterprise Holdings Inc. All Rights Reserved. Reproduction in whole or in part in any form or medium without express written permission of Ziff Davis Enterprise is prohibited. Windows is a trademark or registered trademark of Microsoft Corporation in the United States and/or other countries and is used by WindowsForDevices under license from owner. All other marks are the property of their respective owners. WindowsForDevices is an independent publication not affiliated with Microsoft Corporation.