cryptography

Amazon S3 POST api, and signing a policy with NodeJS

↘锁芯ラ 提交于 2020-01-20 14:23:50
问题 I'm trying to get an built that allows users to upload a file directly to my Amazon S3 bucket, from a NodeJS powered website. It seems the only tutorials out there, other than the actual amazon docs for this are all very out of date. I've been following this tutorial , for the basic info, but again it's out dated. It doesn't have the method calls to crypto correct, as it tries to pass a raw JavaScript object to the update method, which throws an error because it's not a string or buffer. I've

Amazon S3 POST api, and signing a policy with NodeJS

余生长醉 提交于 2020-01-20 14:23:27
问题 I'm trying to get an built that allows users to upload a file directly to my Amazon S3 bucket, from a NodeJS powered website. It seems the only tutorials out there, other than the actual amazon docs for this are all very out of date. I've been following this tutorial , for the basic info, but again it's out dated. It doesn't have the method calls to crypto correct, as it tries to pass a raw JavaScript object to the update method, which throws an error because it's not a string or buffer. I've

find certificate on smartcard currently on reader

廉价感情. 提交于 2020-01-19 07:46:30
问题 I am using Visual Studio 2013 (C#) to digitally sign document using certificate from smartcard. I cannot identify certificate currently inserted in the card reader :( Windows copy certificates from all card inserted in the reader and keep it in the store. I want to use just card cuurently in the reader. code I using is public static byte[] Sign(Stream inData, string certSubject) { // Access Personal (MY) certificate store of current user X509Store my = new X509Store(StoreName.My,

Getting the same result from Ruby as Javascript for bitwise XOR

微笑、不失礼 提交于 2020-01-17 08:34:13
问题 In Ruby: -1104507 ^ 3965973030 => -3966969949 In Javascript: -1104507 ^ 3965973030 => 327997347 Someone asked a similar question here but the answer just pointed to a wrapper for Closure. I need a way to get the same answers from Ruby as I get for JavaScript so I can port this code over. I need a way of being able to get the JavaScript result from any A ^ B in Ruby for any integers A and B . 回答1: Those two are the same result, modulo 2 32 . In Ruby you could & 4294967295 to make the result

Clickbank CBC-AES-256 decryption in c#

落花浮王杯 提交于 2020-01-17 08:10:10
问题 I'm new with this encryption and decryption techniques. I'm working on a task with Clickbank Instant Notification system. I'm getting the encrypted values from Clickbank and I want to decrypt the notification. My problem is very similar to this thread but it is not working for me. It is throwing following error: Specified initialization vector (IV) does not match the block size for this algorithm. Below is my code for decryption. protected void Page_Load(object sender, EventArgs e) { //Sample

OpenSSL SHA1 not validating NIST SHAKE test vector?

坚强是说给别人听的谎言 提交于 2020-01-17 07:14:44
问题 I have written a C code which calls on OpenSSL SHA1 to generate a digest but my generated digest is not matching. #define MSG_SIZE 190 #include <stdio.h> #include <string.h> #include <openssl/sha.h> void str2hex(char *str, unsigned char *hex, int len) { int tt, ss; char temp[5]; for (tt = 0, ss = 0; tt < len, ss < 2 * len; tt++, ss += 2) { temp[0] = '0'; temp[1] = 'x'; temp[2] = str[ss]; temp[3] = str[ss + 1]; temp[4] = 0; hex[tt] = strtol(temp, NULL, 0); } } int main() { unsigned char digest

Clarifying the EVP_BytesToKey() function in OpenSSL

拥有回忆 提交于 2020-01-17 07:08:26
问题 I'm looking at this page: http://www.openssl.org/docs/crypto/EVP_BytesToKey.html There, it says the following: If the total key and IV length is less than the digest length and MD5 is used then the derivation algorithm is compatible with PKCS#5 v1.5 otherwise a non standard extension is used to derive the extra data. I'm using the AES-256-CBC cipher and MD5. What does that tell me judging from the above excerpt? Does it mean that I'm compatible with PKCS#5 v1.5, or does it mean that it's

nodejs pbkdf2sync Not a buffer error

最后都变了- 提交于 2020-01-17 05:16:09
问题 Suddenly in my console it's start giving errors, and it has been running fine for days without any change. Please advise. /node_modules/mysql/lib/protocol/Parser.js:82 throw err; ^ TypeError: Not a buffer at TypeError (native) at pbkdf2 (crypto.js:607:20) at Object.exports.pbkdf2Sync (crypto.js:590:10) crypto: require("crypto"), encrypt: function(password) { var salt = this.getSalt(password, this.constructor.GUID); return {salt: salt, password: this.getEncrypted(password, salt)}; }, getSalt:

CMSSignedDataStreamGenerator hash does not match

点点圈 提交于 2020-01-17 01:25:09
问题 I'm writing an application that signs and envelopes data using BouncyCastle . I need to sign large files so instead of using the CMSSignedDataGenerator (which works just fine for small files) I chose to use CMSSignedDataStreamGenerator . The signed files are being generated but the SHA1 hash does not match with the original file. Could you help me? Here`s the code: try { int buff = 16384; byte[] buffer = new byte[buff]; int unitsize = 0; long read = 0; long offset = file.length();

What is the .NET equivalent of the PHP function hash_hmac()

左心房为你撑大大i 提交于 2020-01-16 14:10:43
问题 I'm porting some code from PHP to .NET (I'm not a PHP developer) and it all looks pretty straightforward apart from the following line: public function hash($message, $secret) { return base64_encode(hash_hmac('sha1', $message, $secret)); } How can I port this function to .NET? The base64 encoding is done as follows, but how do I replicate hash_hmac()? Convert.ToBase64String(System.Text.Encoding.ASCII.GetBytes(tmpString)); Thanks! 回答1: If you're looking for an HMAC then you should be using a