hmacsha1

Wrong result for base64 string of HMAC_SHA1 using Crypto*** API

拟墨画扇 提交于 2019-12-02 11:30:45
问题 I'm trying to use the winapi crypto api to get a base64 encoded hash. I copied and modified to get the function below. I got it from here mostly - https://msdn.microsoft.com/en-us/library/windows/desktop/aa382379(v=vs.85).aspx Running it with calcHmacSha1("message", "key") should give IIjfdNXyFGtIFGyvSWU3fp0L46Q= . However it gives me SlLDwKvAoGBJ0atki7QFfj/181k= , the non base64 version it gives is 4a 52 c3 c0 ab c0 a0 60 49 d1 ab 64 8b b4 05 7e 3f f5 f3 59 . This is a same situation

Node HmacSHA1 Seed

房东的猫 提交于 2019-12-02 09:58:35
I'm trying to send a SOAP request via Node, talking to a service which is secured with WSS. I need to sign the XML response with a SignedInfo element which requires me combining a Nonce Binary secret I generated, with a Nonce binary secret returned from the initial token request - PSHA1 format. I've been able to validate this using Java, by utilising the following class (Where the secret is my client nonce and the seed is the server nonce): https://github.com/apache/wss4j/blob/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/derivedKey/P_SHA1.java#L57 With the following Java code

HMAC SHA1 Signature in Java

狂风中的少年 提交于 2019-12-01 09:23:21
I am trying to interface with a TransUnion web service and I need to provide a HMAC-SHA1 signature to access it. This example is in the TransUnion documentation: Input of SampleIntegrationOwner2008‐11‐18T19:14:40.293Z with security key xBy/2CLudnBJOxOtDhDRnsDYq9HTuDVr2uCs3FMzoxXEA/Od9tOuwSC70+mIfpjeG68ZGm/PrxFf/s/CzwxF4Q== creates output of /UhwvT/kY9HxiXaOjpIc/BarBkc= . Given that data and key, I cannot get this same result in Java. I have tried several online calculators, and none of them return this result either. Is the example in their documentation incorrect, or am I just not handling

HMAC SHA1 Signature in Java

半城伤御伤魂 提交于 2019-12-01 06:49:03
问题 I am trying to interface with a TransUnion web service and I need to provide a HMAC-SHA1 signature to access it. This example is in the TransUnion documentation: Input of SampleIntegrationOwner2008‐11‐18T19:14:40.293Z with security key xBy/2CLudnBJOxOtDhDRnsDYq9HTuDVr2uCs3FMzoxXEA/Od9tOuwSC70+mIfpjeG68ZGm/PrxFf/s/CzwxF4Q== creates output of /UhwvT/kY9HxiXaOjpIc/BarBkc= . Given that data and key, I cannot get this same result in Java. I have tried several online calculators, and none of them

Crypto++ pbkdf2 output is different than Rfc2898DeriveBytes (C#) and crypto.pbkdf2 (JavaScript)

天大地大妈咪最大 提交于 2019-12-01 05:28:52
So I'm trying to use PBKDF2 to derive a key given a base64 string of 256bits. I am able to use C#'s Rfc2898DeriveBytes and node-crypto's pbkdf2 to derive the same key, however, I can't say the same for C++. I'm not sure if I'm doing wrong conversions or using the functions improperly, but I'll let you guys look at it. C++ /* 256bit key */ string key = "Y1Mjycd0+O+AendY5pB58JMlmS0EmBWgjdj2r2KW6qQ="; string decodedKey; StringSource(key, true, new Base64Decoder(new StringSink(decodedKey))); const byte* keyByte = (const byte*) decodedKey.data(); /* Generate IV */ /* AutoSeededRandomPool prng; byte

Crypto++ pbkdf2 output is different than Rfc2898DeriveBytes (C#) and crypto.pbkdf2 (JavaScript)

≯℡__Kan透↙ 提交于 2019-12-01 02:23:49
问题 So I'm trying to use PBKDF2 to derive a key given a base64 string of 256bits. I am able to use C#'s Rfc2898DeriveBytes and node-crypto's pbkdf2 to derive the same key, however, I can't say the same for C++. I'm not sure if I'm doing wrong conversions or using the functions improperly, but I'll let you guys look at it. C++ /* 256bit key */ string key = "Y1Mjycd0+O+AendY5pB58JMlmS0EmBWgjdj2r2KW6qQ="; string decodedKey; StringSource(key, true, new Base64Decoder(new StringSink(decodedKey)));

PHP Curl HMAC-SHA1

孤人 提交于 2019-12-01 01:34:19
Need help on this .... I need to get json data from API call from a URL. It said the called need.. Content-Type : application/x-www-form-urlencoded HTTP HEADERS : key ---> APIKEY HTTP HEADERS : sig ---> HMAC-SHA1 signature of POST Data with SECRET KEY POST PARAMETER: timestamp ----> Current Unix Timestamp Do I do this correctly? But how to implement point 3 above??? $key = 'APIKEY'; $secret = 'APISECRET'; $signature = ''; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://www.domain.com/getticker"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_HEADER, FALSE);

PHP Curl HMAC-SHA1

好久不见. 提交于 2019-11-30 21:12:43
问题 Need help on this .... I need to get json data from API call from a URL. It said the called need.. Content-Type : application/x-www-form-urlencoded HTTP HEADERS : key ---> APIKEY HTTP HEADERS : sig ---> HMAC-SHA1 signature of POST Data with SECRET KEY POST PARAMETER: timestamp ----> Current Unix Timestamp Do I do this correctly? But how to implement point 3 above??? $key = 'APIKEY'; $secret = 'APISECRET'; $signature = ''; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://www.domain

Base64 HMAC SHA1 String in VBA

℡╲_俬逩灬. 提交于 2019-11-28 11:37:25
I'm trying to convert an ASP/VBScript OAuth library to VBA. One of the challenges is this line of code: Get_Signature = b64_hmac_sha1(strSecret, strBaseSignature) This function, b64_hmac_sha1 is actually a function contained in a JavaScript library. It appears to me that calling a JavaScript function from VBA is fairly impractical. Because I know so little about encryption, it's not even clear to me what this b64_hmac_sha1 function does. Is HMAC SHA1 different from SHA1? I half suspect I might be able to find some VBA code online to do what I need to do if I just understood what this function

CommonHMAC in Swift

邮差的信 提交于 2019-11-26 12:16:41
I'm trying to create a HMAC SHA-1 hash of a string in Swift but can't figure out how to interact with the APIs as it doesn't seem to be importing the CommonCrypto framework. I've tried various different forms of "import CommonCrypto" and creating a bridging header file but none of it made a difference. The odd thing is that if I create an Objective-C class, I'm able to interact with APIs without any problems, so this seems to be unique to Swift. Also if anyone could tell me what the equivalent of uint8_t digest[CC_SHA1_DIGEST_LENGTH] is in Swift I'd be very grateful You can do it in Swift.