HMAC implementation in C with SHA384 - c

I need an HMAC implementation with SHA384 in C. It is needed for some API I'm writing.
If anyone can provide at least a starting point I would be happy. Thanks!

Use the openssl library.
An example of using openssl to generate an SHA384 hash is here: http://www.askyb.com/cpp/openssl-sha384-hashing-example-in-cpp/
It claims to be in C++ but it's pretty much straight C.

Related

How to implement SHA1 in C

I am trying to wrap my head around HOTP values, and I believe the essential building block is understanding the SHA-1 hashing function. I am coding in C, and I have seen many examples of people implementing the SHA1 function using libraries, such as OpenSSL. My question is, if I am attempting to implement my code on hardware that will not have internet access, is it viable to implement SHA1 using a library, or is it possible to create the function from scratch in the code?
I have tried implementing the sha1 algorithm by using libraries from openSSL, however I am not sure if this is the right approach.

Does OpenSSL offer Big Decimal support?

I've used OpenSSL BIGNUM to implement some cryptosystems and I am now wondering if it also offers big decimal support. I could not find anything in the documentation but perhaps there is an extension/add-on somewhere preferably in C (not C++)?
Note: I am aware of GMP and NTL, I am not looking for those.
Does OpenSSL offer Big Decimal support?
No.
As far as I know OpenSSL uses BigNumber library to implement operation on large numbers, ant this is recommended way to follow for devs.
More info: http://linux.die.net/man/3/bn_print

C unix, asymmetric encryption on a socket

i have a client/server application in C unix, and i need to encrypt/decript the data with something like RSA (but not necessarly RSA). Is there a library (and the correspondent documentation) for this kind of function?
You can take a look at SSL/TLS C API.
For a Client/Server Application, the best way to ensure security is by using TLS/SSL.
The latest version of TLS is TLS 1.2 (RFC 5246) and as WagnerVaz has rightly mentioned, the best opensource library available fro TLS is OpenSSL .OpenSSL not only provides the library for TLS/Crypto. But, it also provides you a tool for generating certificates & private keys (based on RSA/DSA etc) on various formats.
Though OpenSSL is the finest TLS Library available in the market, it is a little difficult to understand and use for a first timer. There is a very wonderful tutorial written by Eric Rescorla himself on using OpenSSL.
An Introduction to OpenSSL Programming (Part - I) /
An Introduction to OpenSSL Programming (Part - II)
It would be best if you first try to get some idea as to what is SSL and then start writing code for the same.
Alternately, let's say you are interested only in assymetric encryption / decryption, still OpenSSL's Crypto Libraries can be used.

I am searching for an example in C for using pkcs#5

AFAIK, PKCS#5 is used for hashing passwords. I could not find an example to explain how to use openssl to make a client for hashing the passwords.
i have made a blogpost siting how to hash using openssl in C. Here is the link. Let me know, if this is the one you are looking for?

Fastest path to Lua SHA256 RFC-2104 compliant HMAC signature?

I'm running Debian Linux, and for a Lua script I need to create a SHA256 checksum to authenticate requests to Amazon Web Services. They don't say for sure but it looks as if they may want a base64 encoding of the resulting SHA256 checksum.
I'd be happy if someone had done a Lua binding.
I'd be content if someone could help me figure out how to use the command-line /usr/bin/sha256sum for this purpose.
I'd settle for a pointer to C code and deal with the hassle of the binding and the base64 encoding myself.
I surely don't need to reimplement SHA256 for myself; if someone has an implementation in ANSI standard C that they like, please let me know. Or a better solution!
How about LuaCrypto, a front-end for OpenSSL:
http://luacrypto.luaforge.net/
It looks like mushclient has already written a Lua wrapper for a SHA-256 library.
A work-around might be the free signing service at http://apisigning.com/

Resources