cryptoapi

MD5-SHA1 hash using CryptoAPI

家住魔仙堡 提交于 2019-11-28 12:07:20
问题 I have requirement of signing a data using MD5-SHA1 hash (MD5 hash and SHA1 hash of the data are combined and then signed). Primary requirement: MD5-SHA1 hash is provided by OpenSSL in some way that is not exposed. This hash is complete. Now my requirement is to sign this hash using Crypto API without hashing (only signing is required, not hashing again). Why CryptoAPI, not OpenSSL? Because, I am dealing with a certificate with non-exportable private key. Its private key can only be used by

VS2010 - Structure change in CryptoAPI - v7.0A Vs v6.0A - WinCrypt.h

别说谁变了你拦得住时间么 提交于 2019-11-28 07:37:45
问题 In C:\Program Files\Microsoft SDKs\Windows\v7.0A\Include\WinCrypt.h , the definition for CERT_CHAIN_ENGINE_CONFIG is typedef struct _CERT_CHAIN_ENGINE_CONFIG { DWORD cbSize; HCERTSTORE hRestrictedRoot; HCERTSTORE hRestrictedTrust; HCERTSTORE hRestrictedOther; DWORD cAdditionalStore; HCERTSTORE* rghAdditionalStore; DWORD dwFlags; DWORD dwUrlRetrievalTimeout; // milliseconds DWORD MaximumCachedCertificates; DWORD CycleDetectionModulus; *#if (NTDDI_VERSION >= NTDDI_WIN7) HCERTSTORE

Java security - MSCAPI provider: How to use without password popup?

落花浮王杯 提交于 2019-11-28 00:29:40
问题 I've managed to use Sun's MSCAPI provider in my application. The problem I'm having now is that it always pops up a window, asking for a password, even though I've provided it in the code. This is a problem, because I need the cryptography functionality in a webservice. Here's the code I have now: String alias = "Alias to my PK"; char[] pass = "MyPassword".toCharArray(); KeyStore ks = KeyStore.getInstance("Windows-MY"); ks.load(null, pass); Provider p = ks.getProvider(); Signature sig =

Load an PEM encoded X.509 certificate into Windows CryptoAPI

廉价感情. 提交于 2019-11-27 18:37:12
I need to load a PEM encoded X.509 certificate into a Windows Crypto API context to use with C++. They are the ones that have -----BEGIN RSA XXX KEY----- and -----END RSA XXX KEY----- . I found examples for Python and .NET but they use specific functions I can't relate to the plain Windows Crypto API. I understand how to encrypt/decrypt once I've got a HCRYPTKEY. BUT, I just don't get how to import the Base64 blob in the .PEM file(s) and get a HCRYPTKEY that I can use out of it. I have that strange feeling that there is more to it than simply calling CryptDecodeObject() . Any pointers that can

Window C/C++ Crypto API Examples and tips

雨燕双飞 提交于 2019-11-27 17:32:14
I'm asking this question because I've spent the best part of a day trawling through msdn docs and other opaque sources for simple straightforward guidelines on how to get started with the Windows C/C++ Crypto API. What I'd like to see is some example code, typical include paths, linking guidelines, etc, anything useful really. I know this is an imprecise question but I reckon imprecise answers are better none at all. I'll get the ball rolling with my own meager findings... Gearoid Murphy Here's a bunch of examples I've found.... Example C Program: Listing the Certificates in a Store Example C

How to generate an HMAC in Java equivalent to a Python example?

人盡茶涼 提交于 2019-11-27 11:01:41
I'm looking at implementing an app getting Twitter authorization via Oauth in Java. The first step is getting a request token . Here is a Python example for app engine. To test my code, I am running Python and checking output with Java. Here is an example of Python generating a Hash-Based Message Authentication Code (HMAC): #!/usr/bin/python from hashlib import sha1 from hmac import new as hmac key = "qnscAdgRlkIhAUPY44oiexBKtQbGY0orf7OV1I50" message = "foo" print "%s" % hmac(key, message, sha1).digest().encode('base64')[:-1] Output: $ ./foo.py +3h2gpjf4xcynjCGU5lbdMBwGOc= How does one

how to use CryptoAPI in the linux kernel 2.6

会有一股神秘感。 提交于 2019-11-27 01:45:53
问题 I have been looking for some time but have not found anywhere near sufficient documentation / examples on how to use the CryptoAPI that comes with linux in the creation of syscalls / in kernel land. If anyone knows of a good source please let me know, I would like to know how to do SHA1 / MD5 and Blowfish / AES within the kernel space only. 回答1: There are a couple of places in the kernel which use the crypto module: the eCryptfs file system (linux/fs/ecryptfs/) and the 802.11 wireless stack

Load an PEM encoded X.509 certificate into Windows CryptoAPI

不羁的心 提交于 2019-11-26 22:42:11
问题 I need to load a PEM encoded X.509 certificate into a Windows Crypto API context to use with C++. They are the ones that have -----BEGIN RSA XXX KEY----- and -----END RSA XXX KEY----- . I found examples for Python and .NET but they use specific functions I can't relate to the plain Windows Crypto API. I understand how to encrypt/decrypt once I've got a HCRYPTKEY. BUT, I just don't get how to import the Base64 blob in the .PEM file(s) and get a HCRYPTKEY that I can use out of it. I have that

Window C/C++ Crypto API Examples and tips

◇◆丶佛笑我妖孽 提交于 2019-11-26 19:03:33
问题 I'm asking this question because I've spent the best part of a day trawling through msdn docs and other opaque sources for simple straightforward guidelines on how to get started with the Windows C/C++ Crypto API. What I'd like to see is some example code, typical include paths, linking guidelines, etc, anything useful really. I know this is an imprecise question but I reckon imprecise answers are better none at all. I'll get the ball rolling with my own meager findings... 回答1: Here's a bunch

How to generate an HMAC in Java equivalent to a Python example?

房东的猫 提交于 2019-11-26 15:23:37
问题 I'm looking at implementing an app getting Twitter authorization via Oauth in Java. The first step is getting a request token. Here is a Python example for app engine. To test my code, I am running Python and checking output with Java. Here is an example of Python generating a Hash-Based Message Authentication Code (HMAC): #!/usr/bin/python from hashlib import sha1 from hmac import new as hmac key = "qnscAdgRlkIhAUPY44oiexBKtQbGY0orf7OV1I50" message = "foo" print "%s" % hmac(key, message,