hmac

How to calculate HMAC-SHA1 authentication code in .NET 4.5 Core

馋奶兔 提交于 2019-12-09 13:01:52
问题 I’m currently facing a big problem (Environment: .NET 4.5 Core): We need to protect a message with a key using a HMAC-SHA1 algorithm. The problem is that the HMACSHA1-class of the namespace System.Security.Cryptography and the namespace itself do not exist in .NET 4.5 Core, this namespace only exists in the normal version of .NET. I tried a lot of ways to find an equivalent namespace for our purpose but the only thing I found was Windows.Security.Cryptography which sadly does not offer a HMAC

HMAC SHA-512 generation discrepancies between iOS and javascript libraries

强颜欢笑 提交于 2019-12-09 03:22:32
问题 I am trying to replicate the Hmac generation behavior from my iOS app using SHA-512 algorithm referring to this link Objective-C sample code for HMAC-SHA1. For this purpose, I have tried using CrytoJS and jsSHA libraries to compute the Hmac using javascript code. I have found discrepancies in hmac values generated by these javascript libraries and the one that I have using my iOS code. Can someone help me understand what could I be doing wrong here? I have a feeling that I am messing up with

Binary Output from Google Script HMAC encription

不羁岁月 提交于 2019-12-08 21:36:38
问题 I am current working with Google Apps script and am attempting to write & sign an HTTP request to AWS CloudWatch. On the Amazon API documentation here regarding how to create a signing key, they use pseudo to explain that the HMAC algorithm is to return binary format. HMAC(key, data) represents an HMAC-SHA256 function that returns output in binary format. Google apps script offers a method to do such a hash, Utilities.computeHmacSignature(Utilities.MacAlgorithm.HMAC_SHA_256, data, key); but

How to suppress phpseclib “Invalid HMAC” warning

痴心易碎 提交于 2019-12-08 09:48:40
问题 I am using phpseclib to transfer files via SFTP, but login fails with Invalid HMAC I need to ignore this server warning. For example with curl command I use the -k option. Can I do the same with phplibsec? -k, --insecure (SSL) This option explicitly allows curl to perform "insecure" SSL connections and transfers. All SSL connections are attempted to be made secure by using the CA certificate bundle installed by default. This makes all connections considered "insecure" fail unless -k, -

Using CommonCrypto/CommonHMAC to encrypt some data and always comes back null

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-08 02:01:31
问题 I tried the following to encrypt the clearTextData using the key keyData . And I did check to make sure that both of those values are valid and going through. NSData *keyData = [PRIVATE_KEY dataUsingEncoding:NSUTF8StringEncoding]; NSData *clearTextData = [data dataUsingEncoding:NSUTF8StringEncoding]; uint8_t digest[CC_SHA1_DIGEST_LENGTH] = {0}; CCHmacContext hmacContext; CCHmacInit(&hmacContext, kCCHmacAlgSHA1, keyData.bytes, keyData.length); CCHmacUpdate(&hmacContext, clearTextData.bytes,

AES-Encrypt-then-MAC a large file with .NET

馋奶兔 提交于 2019-12-08 01:50:56
问题 I want to encrypt a large file (lets say 64 GB) in the most efficient way in .NET. How I would implement this: Create an instance of AesManaged to encrypt the stream of the file (read 64 GB) Save this stream to disk (because it is to big to hold in memory) (write 64 GB) Create an instance of HMACSHA512 to compute hash of the saved file (read 64 GB) Save encrypted data with iv to disk (read & write 64 GB) Simplified C# Code: using (var aesManaged = new AesManaged()) { using (var msEncrypt =

Nodejs - Expressjs - Verify shopify webhook

☆樱花仙子☆ 提交于 2019-12-07 21:40:04
问题 I am trying to verify the hmac code sent from a shopify webhook on a dev environment. However shopify will not send a post request for a webhook to a non live endpoint, so I am using requestbin to capture the request and then use postman to send it to my local webserver. From shopify documentation, I seem to be doing everything right and have also tried applying the method used in node-shopify-auth verifyWebhookHMAC function. But none of this has worked so far. The codes are never a match.

How can I create a matching HMAC value to verify a Shopify WebHook in .NET?

送分小仙女□ 提交于 2019-12-07 10:13:39
问题 I have set up an endpoint to receive webhook requests from Shopify. The requests from Shopify include an HMAC header that is created from a shared secret key and the body of the request. I need to calculate the HMAC on my server and match it to the value in the request header to ensure that the request is authentic. I can't seem to create the appropriate mechanism in .NET to create a matching HMAC value. My algorithm at this point is as follows: public static string CreateHash(string data) {

HMACSHA1.ComputeHash() thread-safety question

左心房为你撑大大i 提交于 2019-12-07 07:41:46
问题 i am asking myself if it would be dangerous on a asp.net page´s codebehind to use an static (Shared) variable which holds an HMACSHA1-instance. the problem is that the same HMACSHA1-instance would be used by all the asp.net worker-process´ threads when processing multiple simultaneous requests on the same asp.net-page. all (HMACSHA1)instance- and ComputeHash()-method variables which are used/modified by ComputeHash() would be shared (= could be modified) by all the threads?! is that

HMC SHA1 hash - C# producing different hash output than Ruby

旧街凉风 提交于 2019-12-07 06:27:16
问题 I'm trying to quickly get a buggy .Net client library for a third party service I'm using to work. The original library (which works) is written in Ruby, but their equivalent library for DotNet produces differing hash output to the Ruby library. The Ruby encryption code is as follows: def self.encrypt_string(input_string) raise Recurly::ConfigurationError.new("Recurly gem not configured") unless Recurly.private_key.present? digest_key = ::Digest::SHA1.digest(Recurly.private_key) sha1_hash = :