Skip to content

Console application demonstrates unexpected results with CryptDecrypt API with RSA encryption

Notifications You must be signed in to change notification settings

Bob11327/CryptDecrypt-RSATest

Repository files navigation

CryptDecrypt-RSATest

Console application demonstrates unexpected results with CryptDecrypt API with RSA encryption

This sample application demonstrates encrypting data in a specific way:

  • using CryptoAPI (not newer CNG/NCrypt API)
  • using "Microsoft Enhanced RSA and AES Cryptographic Provider" container
  • using the PROV_RSA_AES provider
  • using the AT_KEYEXCHANGE key for encryption & decryption

In this test scenario, a blob of data is encrypted with padding to key size (128 bytes). When the data is decrypted, the CRYPT_DECRYPT_RSA_NO_PADDING_CHECK flag is used to get the entire data with padding, rather than just the original data back.

This code produces the expected results on Windows "desktop" OSes 8.1 and 10, and on Windows Server OSes 2012R2 and 2016.

INCORRECT RESULTS are returned on Windows 8 and earlier desktop OSes, and on Windows Server 2012 and earlier.

About

Console application demonstrates unexpected results with CryptDecrypt API with RSA encryption

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published