Welcome to TechNet Blogs Sign in | Join | Help

TechNet Presents: MCS Talks Enterprise Architecture session 4 – Security and PKI

You may be interested in one of our upcoming sessions that is focused on PKI design and is available for registration here: http://blogs.technet.com/mcstalks/archive/2008/09/02/session-4-details-security-and-pki-registration-now-available.aspx

Posted by MS2065 | 0 Comments
Filed under:

You cannot add V2 or V3 templates after an inplace upgrade was performed on a Windows Server 2008 enterprise CA

Technically, it is possible to install an enterprise CA on a Windows Server Standard edition. With this configuration, enterprise features of the certification authority are intentionally not available.

To enable the CA enterprise features, it is required to upgrade a Windows Server from Standard to Enterprise edition. To keep the existing enterprise CA configuration, it is recommended to just perform a Windows inplace upgrade. If you do this on a Windows Server 2008 you will recognize that only V1 certificate templates are available for assigning after the upgrade was performed.

To fix the problem, close the Certificate Services MMC snap-in and run the following commands with administrator permissions at a command-line on the CA computer:

certutil -setreg ca\setupstatus +512

net stop certsvc

net start certsvc

When you re-open the Certificate Services MMC snap-in, you are able to assign V1, V2 and V3 certificate templates to the certification authority.

Posted by MS2065 | 0 Comments
Filed under: , ,

How EffectiveDate (thisupdate), NextUpdate and NextCRLPublish are calculated

The validity time of a certificate revocation list (CRL) is critical for every public key infrastructure. By default, most applications verify the validity of certificates against a CRL.

Two CRL types exist: base CRLs and delta CRLs. In case where no delta CRL is used, certificates are treated as invalid if the base CRL is not available or expired. If a delta CRL is in use, the delta and base CRL must be available and valid to succeed with certificate verification.

The information provided in this article applies for both, the base CRL and the delta CRL generation.

When you look at a CRL, there is information about the Next update, the Next CRL Publish and the Effective date of the CRL. The term Effective date is used in the Windows certificate dialog while certutil.exe and the RFC name this field thisupdate.

Effective Date (aka thisupdate) - The date that a CRL became effective. The effective time, by default, is set to 10 minutes prior to the current date and time to allow for clock synchronization issues.

Next CLR Publish - This non-critical CRL extension indicates the date and time when a Windows CA will publish a new CRL. When a Windows computer uses a CRL for certificate verification it also examines the Next CRL Publish extension. If the Next CRL Publish date is already in the past, it connects to the CRL distribution points (referenced in the certificate) and attempts a download of a newer CRL. The time after the Next CRL Publish and before the Next Update is a buffer time to allow Windows computers retrieval of a CRL before the CRL has actually expired.

Next Update - The date and time that a Windows client considers as the expiration date of the CRL. From an operational viewpoint, this is the most critical information. If this date passes, Windows computers will invalidate certificates that are checked against this CRL.

Now we know the CRL attributes that control the CRL validity. The question is how these dates are calculated by a Windows CA. Read on to find out!

Under the Certification Services configuration hive in the registry two values control the overlap period for the base CRL and two registry values define the overlap period for delta CRL creation:

HLKLM\SYSTEM\CurrentControlSet\Services\CertSvc\Configuration\<CA Name>:

CRLOverlapPeriod=REG_SZ:Hours|Minutes
CRLOverlapUnits=REG_DWORD:0x0
CRLDeltaOverlapPeriod=REG_SZ:Hours|Minutes
CRLDeltaOverlapUnits=REG_DWORD:0x0

You can verify the settings for the above registry keys on your CA computer with the following commands:

certutil -getreg CA\CRLOv*

certutil -getreg CA\CRLDeltaOv*

If the registry values are set and valid, the overlap period for a base or delta CRL is initially calculated by the CA as:

OverlapPeriod = CRLOverlapUnits

If an invalid or no value is present under the CRLOverlapUnits registry key, the OverlapPeriod for a base CRL is initially calculated as 10 percent of the CRLPeriod and CRLPeriodUnits registry values:

OverlapPeriod = (CRLPeriodUnits * CRLPeriod) / 10

If the OverlapPeriod for a Delta CRL is calculated, the entire period of time specified as CRLDeltaPeriod and CRLDeltaPeriodUnits of the delta CRL is used.

OverlapPeriod = (CRLDeltaPeriodUnits * CRLDeltaPeriod)

As a next step, the smaller value of either the so far calculated OverlapPeriod or 12 hours is taken.

OverlapPeriod = min(OverlapPeriod, 12 hours)

If no CRLPeriodUnits or CRLDeltaPeriodUnits have been set, the OverlapPeriod is 0 at this point. As a next step, the ClockSkewMinutes parameter from the registry is taken into account. The ClockSkewMinutes are primarily used to mitigate time differences between a client computer and the CA. To further calculate the OverlapPeriod, the ClockSkewMinutes is multiplied by 1.5 and then compared with the calculated OverlapPeriod. The greater of both values wins.

OverlapPeriod = max(OverlapPeriod, 1.5 * ClockSkewMinutes)

In case the Overlap period is calculated for a base CRL, it cannot be longer than CRLPeriodUnits * CRLPeriod. Therefore the smaller value wins.

OverlapPeriod = min(OverlapPeriod, CRLPeriodUnits * CRLPeriod)

Is the Overlap time calculated for a delta delta CRL, the OverlapPeriod can not be longer than CRLDeltaPeriodUnits * CRLDeltaPeriod.

OverlapPeriod = min(OverlapPeriod, CRLDeltaPeriodUnits * CRLDeltaPeriod)

Finally, the ClockSkewMinutes are added to the calculated OverlapPeriod.

OverlapPeriod = OverlapPeriod + ClockSkewMinutes

The calculation of the OverlapPeriod is done so far. The the actual calculation of the CRL values can start a next step:

The Effective Date must not be earlier than the CA certificate became valid. This is because the CRL carries the CA certificate's signature.

Effective Date = max(Current Time - ClockSkewMinutes, NotBefore_date_from_the_CA_certificate)

The Next CRL Publish for a base CRL is calculated as the sum of current time plus CRLPeriod:

Next CRL Publish = Current Time + (CRLPeriodUnits * CRLPeriod)

The Next CRL Publish for a delta CRL is calculated as the sum of current time plus CRLDeltaPeriod:

Next CRL Publish = Current Time + (CRLDeltaPeriodUnits * CRLDeltaPeriod)

The Next Update is for a base CRL is calculated with the following formula:

NextUpdate = min(Current Time + (CRLPeriodUnits * CRLPeriod) + OverlapPeriod + ClockSkewMinutes, NotAfter_date_from_the_CA_certificate)

The Next Update is for a delta CRL is calculated with the following formula:

NextUpdate = min(Current Time + (CRLDeltaPeriodUnits * CRLDeltaPeriod) + OverlapPeriod + ClockSkewMinutes, NotAfter_date_from_the_CA_certificate)

Since you have understood the algorithm now, you may want to examine the CRL on your system and see what the dates are set to. If you open the certificate management MMC snap-in from a command-line, you can see a list of all CRLs that have been generated by the CA so far. At a command-prompt, perform the following command:

certsrv.msc /e

With the /e switch, an additional container is shown in the snap-in that lists all CRLs at a glance.

Posted by MS2065 | 0 Comments
Filed under:

New whitepapers about Windows Server 2008 Certificate Services

This blog-entry has two purposes:

1) make you aware of the two new whitepapers that have been just released:

2) provide you a feedback channel. If you have comments about these two papers or any other PKI whitepapers please add a comment to this entry and we will see if we can fix the document.

Posted by MS2065 | 1 Comments
Filed under:

How to determine all certificates that will expire within 30 days

Woudn't it be interesting for the CA admin to know which certificates are expiring in the near future? If autoenrollment is not eanbled, certificate users should be informed in advance before they actually loose functionality.

A simple certutil command enables the CA admin to generate a list with all expiring certificates:

certutil –view –restrict "NotAfter<=5/24/2008 08:00AM,NotAfter>=4/24/2008 08:00AM" –out "RequestID,RequesterName"

Since I mentioned autoenrollment above, here is a trick how to determine if a certificate was enrolled manually or with autoenrollment.

certutil –view -v -out rawrequest | findstr Process

The above command can certainly be extended with the -restrict parameter to reduce the amount of output producted by the query. 

The name of the task performing autoenrollment differs for different OS releases and possible for machine and user contexts. Manually requested certificates may show a process name like certreq or cscript.

Posted by MS2065 | 0 Comments

How to avoid Delta CRL download errors on Windows Server 2008 with IIS7

If delta CRLs are hosted on a Windows Server 2008 server running Internet Information Server 7 (II7), the configuration of a request filter must be changed in the IIS7 configuration.

IIS7.0 does not allow URI’s that do not match upon double escaping. Delta CRLs fall into that category because of the plus sign in the filename.

To change the filter for the site that is hosting the CRLs and delta CRLs, perform the following command at a command line:

appcmd set config "Default Web Site/VDIR" -section:system.webServer/security/requestFiltering -allowDoubleEscaping:true

You have to replace VDIR with the name of the web site hosting the delta CRL, for example:

appcmd set config "Default Web Site/PKI" -section:system.webServer/security/requestFiltering -allowDoubleEscaping:true

To change the setting for the default Web site, use this command:

appcmd set config "Default Web Site" -section:system.webServer/security/requestFiltering -allowDoubleEscaping:true

For related information about the configuration of request filters in IIS7 is found on Microsoft TechNet.

Posted by MS2065 | 0 Comments

Update: Import the Root CA Certificate and CRL into an Intermediate CA from a Batch File

It came to our attention that the Best Practices for Implementing a Microsoft Windows Server 2003 Public Key Infrastructure whitepaper provides wrong guidance in section Import the Root CA Certificate and CRL into an Intermediate CA from a Batch File. The current documentation recommends that the CRL published by the Root CA is to be added to the Root certificate store.

There are two corrections needed for the commands in step #4 in the Import the Root CA Certificate and CRL into an Intermediate CA from a Batch File section:

  1. The -f option should not be used for existing certificate stores. This is to avoid accidental creation of new certificate stores. If you are mistyping the certificate store and use the -f option, a new certificate store is created which becomes a dead store.
  2. The CRL should be added to the intermediate certificate store.

The correct commands would look like the following:

for %C in (FloppyDrive:\*.crt) do certutil –addstore Root %C
for %C in (FloppyDrive:\*.crl) do certutil –addstore
CA %C

Posted by MS2065 | 0 Comments

How to set up a CA with a CNG (ECC) certificate

One of the improvements of the Windows Server 2008 Certification authority is the support for Cryptography Next Generation (CNG) with Elliptic Curve Cryptography (ECC).

 

I have described the CNG capabilities in my Certificate Server Enhancements in Windows Server codename "Longhorn" whitepaper but after reviewing the paper recently I noticed that it does not exactly explain how to set up a new Windows Server 2008 CA with a CNG certificate.

Also, the reference provided in paragraph "Configuring setup using a CAPolicy.inf file" is outdated and refers to an invalid page. The PKCS #1: RSA Cryptography Standard is now documented at http://www.rsa.com/rsalabs/node.asp?id=2125.

 

To set up a CA with a CNG certificate, perform the normal "Active Directory Certificate Services" setup procedure until you reach the Configure Cryptography for CA wizard page. Now you have to decide which Cryptography or Key Provider is used by the CA. All providers that have a #-sign as prefix in their name represent key storage provider and can support CNG algorithms.

 

Even if you don't have a requirement for a CNG certificate today, you should select a key storage provider that is supporting CNG. Luckily, the RSA#Microsoft Software Key Storage Provider is the default setting so that you have greater flexibility regarding hash algorithm configuration compared to cryptographic service providers. How to change the hash algorithm for a key storage provider is described in the chapter "Configuring the Cryptographic Algorithms used by the CA" in the Certificate Server Enhancements in Windows Server codename "Longhorn" whitepaper.

Posted by MS2065 | 1 Comments
Filed under:

Manually importing keys into a smart card

Have you thought about moving a certificate including its (exportable) keys from a user's profile into a smart card? There are three simple steps required to do this if the Microsoft Base Smart Card Crypto Service Provider is available on a computer.

 

1.    As the first step, two registry keys must be modified to permit the import operation.

 

·         HKLM\SOFTWARE\Microsoft\Cryptography\Defaults\Provider\Microsoft Base Smart Card Crypto

Provider\AllowPrivateExchangeKeyImport=DWORD:0x1

·         HKLM\SOFTWARE\Microsoft\Cryptography\Defaults\Provider\Microsoft Base Smart Card Crypto

Provider\AllowPrivateSignatureKeyImport=DWORD:0x1

 

Those registry keys are also documented in the Smart Card Minidriver Specification for Windows Base Cryptographic Service Provider (Base CSP) and Smart Card Key Storage Provider (KSP) and the SmartCard Infrastructure blog.

 

2.    As a next step, the certificate and the keys must be made available as a PFX file. The easiest way to create the file is with the Certificate Export Wizard.

a.     Click Start, Run and type certmgr.msc

b.    In the left pane, click Personal, Certificates

c.     Select a certificate in the right pane.

d.    From the Action menu, click All Tasks and then Export.

e.     Make sure that the private key is exported.

Look after the PFX file, because it contains a private key!

 

3.    Finally, importing a key into a smart card is a single command at a command-line. The certutil-version that ships with Windows Server 2003 SP1 or a later Windows version is required to perform the operation.

 

certutil –csp "Microsoft Base Smart Card Crypto Provider" –importpfx {PFXfile}

 

After the import has finished, remove the PFX file that was created in step #2.

Posted by MS2065 | 0 Comments
Filed under:

How to decode Windows errors

Many Windows error messages provide a hexadecimal error code, for example 0x8007267C. This code can provide helpful information. But how to translate it into a readable error message?

 

At least two commands can be used to decode an error code:

 

·         certutil -error [Code]

·         err.exe [Code]

 

For example

certutil -error 0x8007267C

 

Certutil is part of all Windows server stock keeping units (SKU) and Windows Vista. The err executable is available from the Microsoft Download center.

Posted by MS2065 | 0 Comments

How to refresh the CRL cache on Windows Vista

By default, Windows is caching Certificate Revocation Lists (CRL) and CA certificates to quickly verify certificate chains. The downside of this behavior is that a newer CRL is not picked up by the client until the locally cached CRL has expired.

 

Windows versions before Windows Vista do not support deletion or a forced update of the CRL cache.

 

You can view what is in your current CRL cache with the following command:

certutil -URLcache CRL

 

On Windows Vista, CAPI 2.0 has support to set a expiry date for the CRL and OCSP cache. You can use certutil to set a date and time when all cache entries become invalid. The following commands require administrative permission on the system.

 

To see when the cache was invalidated the last time, perform this command:

certutil –getreg chain\ChainCacheResyncFiletime

 

Note: If the ChainCacheResyncFiletime was never set manually before, the registry key does not exist and the following error message is shown:

CertUtil: -getreg command FAILED: 0x80070002 (WIN32: 2)

CertUtil: The system cannot find the file specified.

The error can be ignored because default CRL caching takes place in this case.

If the @now parameter is used, all cached entries are invalidated immediately.

certutil -setreg chain\ChainCacheResyncFiletime @now

 

To keep the cached entries for another 3 days and 6 hours, use this command:

certutil –setreg chain\ChainCacheResyncFiletime @now+3:6

 

To delete a registry value:

certutil –delreg chain\ChainCacheResyncFiletime

Posted by MS2065 | 1 Comments
Filed under: ,

Windows PKI documentation reference

We have a broad list of documentation for the Windows PKI. To let you find the right content quicker, I have put together a grouped list of the current papers, knowledge base articles and web casts related to the technology.

 

General information

 

Training

 

Internet Newsgroup

 

Envision

 

Plan

 

Build

 

Deploy

 

Windows Server 2003

 

Windows Server 2008

 

Operate

 

Windows Server 2008

 

Develop

 

Extend

Posted by MS2065 | 0 Comments

How to re-install the default certificate templates?

 

When you launch the certificate templates MMC snap-in (certtmpl.msc) for the first time, the certificate templates are installed automatically in the background. Installing the templates is independent of the availability of an enterprise CA. Enterprise Administrator permissions are required to successfully install the templates.

That's nice and convenient but what happens if you accidentally deleted the template objects from Active Directory? The templates can be viewed and also deleted (with appropriate permissions) through the Active Directory Sites and Services MMC snap-in (dssites.msc) or any other LDAP client can be used.

 

 

 

So, what to do if the templates or the OID container have disappeared? With a single command-line, you can get them back. As prerequisite to install the certificate templates you must have create child access to the template container in Active Directory which is the default setting for an enterprise administrator.

 

If you are running Windows Server 2003, use the following command with enterprise administrator permissions:

 

regsvr32 /i:i /n certcli.dll

 

If you have Windows Vista or Windows Server 2008 already in place, certutil.exe understands a new verb to re-install the templates. Certutil is included in all Windows Vista SKUs by default.

 

certutil -installdefaulttemplates

 

After performing one of the above commands you must restart the CA service.

 

The following two knowledgebase articles describe scenarios where re-installation of certificate templates can make sense:

 

Posted by MS2065 | 0 Comments
Filed under:

Marking private keys as non-exportable with certutil -importpfx

When importing a PFX-file with the certificate import wizard, you can choose if the private key should be exportable or not. Your choice is stored in the key storage property identifier that is key-storage specific. In other words, there is no information in the certificate about the exportability of the related private key. It is possible that if you import the same PFX-file into different computers that the private key is maked as exportable on one computer and is not marked as exportable on another.

To perform a PFX-file import at a command-line you may be familiar with the certutil -importPFX command. Since Windows Server 2003 SP1, certutil understands extra arguments to improve the PFX import.

Here is the abstract syntax:

certutil -importPFX {PFXfile} [NoExport|NoCert|AT_SIGNATURE|AT_KEYEXCHANGE]

To make the private key non-exportable, use the following command:

certutil -importPFX [PFXfile] NoExport

To just install the private key but not the certificate, use the NoCert argument. It can be combined with the NoExport argument.

certutil -importPFX [PFXfile] NoCert

There are two more arguments forcing AT_SIGNATURE or AT_KEYEXCHANGE. Both cannot be used in combination and may require a conversion to a RSA key.

certutil -importPFX [PFXfile] AT_SIGNATURE

certutil -importPFX [PFXfile] AT_KEYEXCHANGE

To combine multiple modifiers with one command, all modifiers must appear comma seperated as a single common line parameter. For example:

certutil -importPFX [PFXfile] "NoExport,AT_KEYEXCHANGE"

Posted by MS2065 | 2 Comments
Filed under:

Credential Roaming Hot Fix Available

If you have you already deployed Credential Roaming (see the whitepaper or webcast) or if you have plans to do so, you should be very aware of a new knowledgebase article because the size of your Active Directory might grow unnecessarily.

Refer to knowledgebase article 934797 for more information.

Posted by MS2065 | 0 Comments
More Posts Next page »
 
Page view tracker