# Analysis of Key Storage Mechanism of Asymmetric Key-Related Functions in CNG Crypto Library
## 2 Background/Related Works
### CNG Features  
CNG provides key features, such as cryptographic agility, compliance with federal standards, support for Suite B, kernel mode support, and auditing, and its characteristics are as follows [7; 9]:  
* Cryptographic agility  
One of the key values provided by CNG is cryptographic agility, which is termed cryptographically agnostic. Agility is demonstrated in the conversion of protocol implementations, such as SSL/TLS, CMS, IPSec, and Kerberos, to CNG; in fact, CNG had to replace all algorithm types, such as symmetric key, asymmetric key, hash function, random number generator, and other useful functions. Changes at the protocol level are considered very important because, in many cases, the protocol APIs needed to provide options for algorithm selection or other flexibility were not available.  
* Compliance with federal standards  
The goal of CNG is level 2 certification from the Federal Information Processing Standards 140-2 along with the Common Criteria for a specific platform, while the goal of other platforms is level 1 certification. These platforms perform the same CNG implementation but provide different authentication levels.  
* Support for Suite B  
One of the other important features is that it supports the Suite B algorithm. In February 2005, the U.S. National Security Agency released a well-organized set of cryptography called Suite B for use by the U.S. government, including symmetric key cryptography, secret agreement of the asymmetric key, known as key exchange, digital signatures, and hash functions. The U.S. government announced that the certified Suite B implementation is to be used to protect information classified as top-level confidential and personal information that was previously described as sensitive but unclassified (SBU). Therefore, supporting Suite B is very important both for Microsoft and for application providers and SI companies.  
* Kernel mode support  
CNG supports flexible cryptographic functions by using the same APIs in both the kernel and user modes. SSL/TLS and IPSec using CNG are added to the boot process and executed in kernel mode, but not all CNG functions are executed in kernel mode. All CNG functions can be called if the IRQL of the calling process is set to PASSIVE_LEVEL, except for the functions that are declared not callable in kernel mode. Ksectd_sys, the Microsoft kernel security support provider interface, is a general-purpose software-based cryptographic module that resides at the Windows kernel mode level. This driver runs as an export driver in kernel mode and provides cryptographic services using a public interface for kernel components; however, exceptionally, the DSA algorithm does not support this. CNG does not provide the ability to always add algorithms or providers in kernel mode, while only the implementations that Microsoft provides through kernel mode APIs are supported in kernel mode.  
* Auditing In addition to providing the above security functions, many operations occurring in the CNG layer are audited by a key storage provider of Microsoft in order to satisfy some requirements of the Common Criteria. As a guideline, KSP must audit and generate audit records in the security log.
* Failure of key and key-pair generation with self-test failure.
* Importing and exporting keys.
* Key revocation failure.
* When a persistent key is read from and written to a file.
* Failure of a key-pair consistency check.
* Failure of secret key validation, such as a parity check on a 3-DES key.
* Failure of encryption, decryption, hash function, signature, verification, key exchange, random number generation, etc.
* Cryptographic self-diagnosis.