Data encryption with CryptoAPI

Source: Internet
Author: User

Because overly complex cryptographic algorithms are difficult to implement, in the past, many applications used only very simple encryption techniques, and the result is that encrypted data can easily be deciphered. Using the cryptographic application interface (that is, the cryptography API) provided by Microsoft, or CryptoAPI, makes it easy to add powerful encryption capabilities to your application without having to consider basic algorithms. This paper introduces CryptoAPI and the principle of data encryption, then gives the general steps of writing encryption program with CryptoAPI, and finally demonstrates some functions of CryptoAPI with a file encryption and decryption program.

1. CryptoAPI Introduction

CryptoAPI is a set of functions that must have a cryptographic service provider module (CSP) to complete a mathematical calculation. Microsoft provides a CSP at the operating system level by bundling RSA Base provider, using RSA's public key encryption algorithm, and more CSPs can be added to the application as needed. In fact, a CSP might be able to encrypt data with a special hardware device, such as a smart card. The CryptoAPI interface allows simple function tuning to encrypt data, Exchange public keys, hash out a message to create a digest, and generate a digital signature. It also provides advanced administrative operations, such as using a CSP from a set of possible CSPs. In addition, CryptoAPI provides a foundation for many advanced security services, including the set for E-commerce, the PCT for encrypting client/server messages, and the PFX, code signature, and so on for passing confidential data and keys back and forth between platforms. The architecture of the CryptoAPI is shown below:

Windows OSR2, Windows NT SP3 and later versions, Windows 98, Windows 2000, and so on are currently supported for CryptoAPI. CryptoAPI configuration information is stored in the registry, including the following key:

HKEY_LOCAL_MACHINE\SOFTWARE\
Microsoft \ Cryptography \Defaults
HKEY_CURRENT_USER\ Software \ Microsoft
\ Cryptography \Providers

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.