Questions tagged [cryptoapi]

Cryptography API: Application programming interface that enables application developers to add authentication, encoding, and encryption to Windows-based applications. The API are oriented on the developer of unmanaged (native) applications in C/C++.

Cryptography API: Application programming interface that enables application developers to add authentication, encoding, and encryption to Windows-based applications. The API are oriented on the developer of unmanaged (native) applications in C/C++.

Microsoft cryptographic technologies include CryptoAPI, Next Generation (CNG), Cryptographic Service Providers (CSP), CryptoAPI Tools, CAPICOM, WinTrust, issuing and managing certificates, and developing customizable public key infrastructures. Certificate and smart card enrollment, certificate management, and custom module development are also described.

636 questions
0
votes
0 answers

Win32 CryptoAPI uses RSA algorithm

My current working environnement is: - Language: C - Application type: Win32 - Library: CryptoAPI I want to encrypt a XML file with RSA algorithm, so here where I got my public key: https://csfieldguide.org.nz/en/interactives/rsa-key-generator/…
0
votes
1 answer

What is the correct way to use the Crypto Api for encryption and decryption between client and server?

After many headaches and people advising to stop, I finally managed to get my Server/Client App to work with this API and create the required keys, i.e. Session and Exchange. When I send the public key to the client, it successfully imports the key…
LeeC
  • 11
  • 3
0
votes
1 answer

Windows C API: what's the difference between wincrypt and sspi?

I'm looking at different solutions for windows cryptography, and stumbled across these two libraries. Their header files are Wincrypt.h and Sspi.h. They both seem to provide encryption and decryption routines: CryptEncryptMessage and EncryptMessage,…
MorJ
  • 566
  • 4
  • 14
0
votes
2 answers

How to correctly encode DH parameters using BouncyCastle in Java?

I am trying to reproduce the output of "openssl dhparam -out dh1024.pem 1024" command programatically in Java. The code snippet is following:- DHParametersGenerator generator = new DHParametersGenerator(); …
xkcd
  • 414
  • 5
  • 19
0
votes
1 answer

Incorrect output when decoding rsa string

I have made this code, it's encrypting string and converting it to base64 string (so I can copy it). void EncryptString(std::string data) { DWORD strlen = data.size() * sizeof(char); unsigned char* buffer = new unsigned char[0]; buffer =…
veter0
  • 23
  • 6
0
votes
1 answer

What format is this 128 bit AES key specified with in this example?

I am referencing this gist available online. It's using a hard-coded 128 bit AES key to encrypt/decrypt data. The key is hard-coded in this format: wchar_t default_key[] = L"3igcZhRdWq96m3GUmTAiv9"; How is a 128 bit AES key specified in this…
learnerX
  • 1,022
  • 1
  • 18
  • 44
0
votes
0 answers

Get session key generated from CryptDeriveKey()

I am working with the crypto libraries and I am trying to create a simple password algorithm with the libraries. I used MSDN's Deriving a Session Key from a Password to generate keys by passing in a "username", but I'm not sure how to get the key…
droidnoob
  • 333
  • 5
  • 17
0
votes
0 answers

CryptoAPI use CryptSignMessage sign but openssl cant verify ,how to do?

cryptoapi sign code: void __stdcall pkcs7_crypto_smime_signed(char * strcontext , int contentsize , char * cerbuffer ,char * cerpassword , int cersize, char ** outdata , int * outdatasize , int * outerrresult /PCRYPT_DATA_BLOB pEncodedBlob, LPWSTR…
Kernal
  • 1
  • 2
0
votes
1 answer

How to store and retrieve encryption key using blob with cryptoApi

I am using blob in my encryption application to store the encryption key. I am a beginner in MFC. I am using CryptExportKey() to export key to the blob. I have put the below code in my Encrypt() function. See the code in the Encrypt() function…
Prasanth
  • 75
  • 8
0
votes
1 answer

How to create a public/private key pair to use with OpenSSL

i am trying to create a windows application which creates a public and private key and export this so that i can use this with OpenSSL. I took same examples provided by MSDN but there is something wrong... I think its a problem of the sizes for…
user8092240
  • 41
  • 1
  • 6
0
votes
1 answer

How to save encryption key in registry in CryptoAPI?

I am new to MFC and CryptoAPI. I want to encrypt trace files in my application. The key derived successfully using a password and I am able to encrypt the data. The encrypted data written in a file. While opening the file again the key becomes 0…
Prasanth
  • 75
  • 8
0
votes
2 answers

Pinvoking adwapi.dll - cryptDecrypt and cryptEncrypt functions, weird problem

I am observing wierd behaviour of this function, the string that I want to encrypt contains 14 bytes, if I use the function to send lenght of buffer = 14, it fails ("an internal error" - very descriptive and most helpful error code), but it works…
0
votes
1 answer

CryptImportKey in CryptoAPI accepts hPubKey of 0 to import encrypted session key

Can anyone explain why the CryptImportKey function accepts an hPubKey of 0 (the decryption key handle), when importing an encrypted session-type key-blob from another computer? The environment is this: PC #1: Generates a key exchange key-pair…
0
votes
2 answers

P/Invoking CryptImportKey and marshaling structs

I'm trying to P/Invoke into CryptImportKey from C# to set a known key before encrypting data that will be decrypted in a C++ Win32 service at some point. I have the method signature for the P/Invoke and that all works fine but i can't get it to…
user1333
0
votes
0 answers

How to stop showing smartcard selection dialog in NCryptOpenKey from minidriver if key container not available

I am working on a minidriver project which can generate keypair in smartcard. To generate a keypair from a test application I have to check if there is a keypair exist with the specified container name, if found I have to delete that. To check if a…
iOS-Developer84
  • 654
  • 8
  • 19