hmac

Using HMAC SHA256 in Ruby

随声附和 提交于 2019-12-03 03:21:19
I'm trying to apply HMAC-SHA256 for generate a key for an Rest API. I'm doing something like this: def generateTransactionHash(stringToHash) key = '123' data = 'stringToHash' digest = OpenSSL::Digest.new('sha256') hmac = OpenSSL::HMAC.digest(digest, key, data) puts hmac end The output of this is always this: (if I put '12345' as parameter or 'HUSYED815X', I do get the same) ۯw/{o���p�T����:��a�h��E|q The API is not working because of this... Can some one help me with that? According to the documentation OpenSSL::HMAC.digest Returns the authentication code an instance represents as a binary

Skipping Kerberos authentication prompts with JSch [duplicate]

匿名 (未验证) 提交于 2019-12-03 02:58:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: This question already has an answer here: SFTP connection through Java asking for weird authentication 2 answers I am using the Connect() method in the Ssh Java class below in order to connect to a server using SSH (JSch) and running a command in the server. The problem is that when running Connect() the server prompts the next messages: Kerberos username [********]: Kerberos password for ********: And in order to continue running I need to manually press the Enter key twice, one for the user name and one for the password. I have tried to

Facebook Signed Request for iOS (HMAC SHA256)

匿名 (未验证) 提交于 2019-12-03 02:52:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I've been trying to generate HMAC SHA256 for Facebook signed request on iOS for weeks now. I am desperate need of help. Facebook signed requests have two parts which are separated by a period. First part is an HMAC256 of the payload while the 2nd part is Base64 encoded string of the payload. I've only been able to recreate the second part. vlXgu64BQGFSQrY0ZcJBZASMvYvTHu9GQ0YM9rjPSso . eyJhbGdvcml0aG0iOiJITUFDLVNIQTI1NiIsIjAiOiJwYXlsb2FkIn0 I've been using the following code that everybody uses but it's generating a different hash: #import

Algorithm negotiation fail SSH in Jenkins

匿名 (未验证) 提交于 2019-12-03 02:51:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I'm trying to ssh from Jenkins to a local server but the following error is thrown: [ SSH ] Exception : Algorithm negotiation fail com . jcraft . jsch . JSchException : Algorithm negotiation fail at com . jcraft . jsch . Session . receive_kexinit ( Session . java : 520 ) at com . jcraft . jsch . Session . connect ( Session . java : 286 ) at com . jcraft . jsch . Session . connect ( Session . java : 150 ) at org . jvnet . hudson . plugins . SSHSite . createSession ( SSHSite . java : 141 ) at org . jvnet . hudson . plugins . SSHSite

HMAC SHA256 macro in Excel

匿名 (未验证) 提交于 2019-12-03 02:33:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I search ed through google, tech forums, etc.... but I couldn't find a good tutorial/guide that answer my question: I have a Cell in Excel with Text, and a Cell with a Key(both text), is there a way to have an HMAC for EXCEL function that get both cell as input and return the hmac text ? thanks in advance 回答1: A quick search on Google revealed a HMAC-SHA256 class written in VB6, located here: http://www.vbforums.com/showthread.php?635398-VB6-HMAC-SHA-256-HMAC-SHA-1-Using-Crypto-API Whilst this is for VB6 (and is native code), it should be

Adding a GitHub repository in Xcode 7 using SSH authentication gives an authentication error

匿名 (未验证) 提交于 2019-12-03 02:31:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to set up a Bot in Xcode 7 for integration testing. As part of setting this up I am adding a remote repository to the project using Xcode > Preferences > Accounts > Add Repository... but it fails with the message Authentication failed : GitHub is working at the command line using this SSH key, why is Xcode 7 not working? 回答1: After thinking that this was an Xcode 7 bug, because of posts like this one I finally found that the problem was actually caused by GitHub. GitHub implemented third party access restrictions for organizations

Bytes message argument error

匿名 (未验证) 提交于 2019-12-03 02:30:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I can't figure out what the 'bytes' method is complaining about. In the code below, i am trying to generate an authentication key for my client and i keep getting this error [1] import hmac import hashlib import base64 message = bytes("Message", 'utf-8') # errors here secret = bytes("secret", 'utf-8') signature = base64.b64encode(hmac.new(secret, message, digestmod=hashlib.sha256).digest()); print(signature) [1] Traceback (most recent call last): File "API/test/auth-client.py", line 11, in <module> message = bytes("Message", 'utf-8')

Ruby and PHP HMACs not agreeing

点点圈 提交于 2019-12-03 02:26:01
I'm trying to create an HMAC in Ruby and then verify it in PHP. Ruby: require 'openssl' message = "A522EBF2-5083-484D-99D9-AA97CE49FC6C,1234567890,/api/comic/aWh62,GET" key = "3D2143BD-6F86-449F-992C-65ADC97B968B" hash = OpenSSL::HMAC.hexdigest('sha256', message, key) p hash PHP: <?php $message = "A522EBF2-5083-484D-99D9-AA97CE49FC6C,1234567890,/api/comic/aWh62,GET"; $key = "3D2143BD-6F86-449F-992C-65ADC97B968B"; $hash = hash_hmac("sha256", $message, $key); var_dump($hash); ?> For the Ruby, I get: 20e3f261b762e8371decdf6f42a5892b530254e666508e885c708c5b0bfc03d3 For the PHP, I get:

Objective-C sample code for HMAC-SHA1 [closed]

匿名 (未验证) 提交于 2019-12-03 02:08:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I need to generate HMAC-SHA1 in Objective C. But i didnt find anything that works. I tried with CommonCrypto, using CCHMAC, but didnt works. I need to generate a hmac and after generate HOTP number. Somebody have any example code in Objective C or C? 回答1: Here's how you generate an HMAC using SHA-256: NSString *key; NSString *data; const char *cKey = [key cStringUsingEncoding:NSASCIIStringEncoding]; const char *cData = [data cStringUsingEncoding:NSASCIIStringEncoding]; unsigned char cHMAC[CC_SHA256_DIGEST_LENGTH]; CCHmac(kCCHmacAlgSHA256,

Paramiko AuthenticationException issue

匿名 (未验证) 提交于 2019-12-03 02:06:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am having a problem connecting to a device with a Paramiko (version 1.7.6-2) ssh client: $ python Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) [GCC 4.4.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import paramiko >>> ssh = paramiko.SSHClient() >>> ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) >>> ssh.connect("123.0.0.1", username="root", password=None) Traceback (most recent call last): File " ", line 1, in File "/usr/lib/pymodules/python2.6/paramiko/client.py", line 327, in