cryptojs

Is AES-CTR in CryptoJS compatible with PyCrypto?

一曲冷凌霜 提交于 2019-12-24 05:49:59
问题 I'm trying to decrypt some AES-CTR-256 data using the PyCrypto library. The ciphertext was produced by the Cryptocat multiparty chat Javascript code, which relies on the CryptoJS library. The IV scheme is as described in the Cryptocat Multiparty Protocol Specification: The Initialization Vector (IV) is composed of 16 bytes: 12 bytes that are randomly generated and 4 bytes acting as the counter, incremented once per block. (The 12 random bytes come before the 4 counter bytes.) Here's my Python

How to Encode nodejs ecdh public key as pem

自作多情 提交于 2019-12-24 04:17:12
问题 Unable to sign a file with nodejs crypto I am trying to verify a signed document created like in this thread using the method verify.verify() with the ECDH public key. Therefore, i guess, i have to format the raw public key into valid PEM. How would i do that using the ans1.js and bn.js module? 来源: https://stackoverflow.com/questions/50874329/how-to-encode-nodejs-ecdh-public-key-as-pem

How to pass encrypted data via browser (HTML5) session variable

£可爱£侵袭症+ 提交于 2019-12-24 00:07:20
问题 I am trying to pass encrypted data via a browser/client session variable - not to be confused with server-side session variable : encrypt: var encrypted_user_id = CryptoJS.AES.encrypt(user_id, cipher_pass); var encrypted_user_password = CryptoJS.AES.encrypt(password, cipher_pass); sessionStorage.setItem('user_id', encrypted_user_id); sessionStorage.setItem('user_password', encrypted_user_password); decrypt: var encrypted_user_id = sessionStorage.getItem('user_id'); var encrypted_user_password

Decrypting AES cipher text using CryptoJS

試著忘記壹切 提交于 2019-12-23 06:06:08
问题 I am trying to follow the instructions seen in the image to complete mutual authentication between a bluetooth smartcard reader and a mobile application. Based on how I've interpreted the instructions, here is my attempt: const randomNumbers = 'd3be845b701b37eff9f24ea6108c0f99'; const masterKey = '41435231323535552d4a312041757468'; const d1 = CryptoJS.AES.decrypt( { ciphertext: CryptoJS.enc.Hex.parse(randomNumbers), }, CryptoJS.enc.Hex.parse(masterKey), { iv: CryptoJS.enc.Hex.parse(

Decrypting AES cipher text using CryptoJS

自闭症网瘾萝莉.ら 提交于 2019-12-23 06:05:27
问题 I am trying to follow the instructions seen in the image to complete mutual authentication between a bluetooth smartcard reader and a mobile application. Based on how I've interpreted the instructions, here is my attempt: const randomNumbers = 'd3be845b701b37eff9f24ea6108c0f99'; const masterKey = '41435231323535552d4a312041757468'; const d1 = CryptoJS.AES.decrypt( { ciphertext: CryptoJS.enc.Hex.parse(randomNumbers), }, CryptoJS.enc.Hex.parse(masterKey), { iv: CryptoJS.enc.Hex.parse(

JavaScript AJAX to Coinbase API, getting “request timestamp expired” error using server time

萝らか妹 提交于 2019-12-23 05:06:10
问题 I've been working on some code that will call the List Accounts call from the Coinbase API. I am using the API Key to authenticate and CryptoJSv3.1.2 to handle the encryption. I believe that I am correctly signing my request but I haven't done a lot of encryption in JavaScript before so please double check my work. The issue that I am having is that my request for accounts is being rejected and the message I'm getting back from Coinbase is {"errors":[{"id":"authentication_error","message":

AES-CTR Encrypt in Go and decrypt in CryptoJS

≯℡__Kan透↙ 提交于 2019-12-23 01:34:22
问题 I have a problem decrypting text, which is encrypted in Go lang, with CryptoJS. Here is Go code: https://play.golang.org/p/xCbl48T_iN package main import ( "crypto/aes" "crypto/cipher" "encoding/base64" "fmt" ) func main() { key := []byte("1234567890123456") plaintext := []byte("text can be a random lenght") block, err := aes.NewCipher(key) if err != nil { panic(err) } // The IV needs to be unique, but not secure. Therefore it's common to // include it at the beginning of the ciphertext. //

Using the nonce and counter correctly for AES-CTR mode

断了今生、忘了曾经 提交于 2019-12-22 08:26:24
问题 I understand that in AES Counter mode I need to use a 128 bit nonce. The naïve way to do that would be to use a random 128 bit nonce, but I'm not sure the algorithm will be able to increment the counter correctly if it's passed as all random bits. I thought the correct way to do it is to use a 96 bit nonce and also a 32 bit counter starting at 0, for example: var key = CryptoJS.enc.Hex.parse('01ab23cd45ef67089a1b2c3d4e5f6a7b'); // 128 bits / 16 bytes var nonce = '2301cd4ef785690a1b2c3dab'; //

nodejs crypto module vs crypto-js

感情迁移 提交于 2019-12-22 05:32:07
问题 I'm quite new to NodeJs and trying to figure out how to use the "crypto" module. While playing around with it I notice the difference between the "crypto" module in NodeJs and crypto-js: With crypto-js, I have: function SHA256Hash(password, salt, iteration) { var saltedpassword = salt + password; var sha256 = CryptoJS.algo.SHA256.create(); for(var i = 0; i < iteration; i++) { alert("saltedpassword = " + saltedpassword); sha256.update(saltedpassword); var saltedpassword = sha256.finalize();

How do I use Sha256 on a file(binary file such as images) in javascript?

为君一笑 提交于 2019-12-21 20:54:59
问题 I am trying to do a Sha256 on a file in Javascript. I used FileReader(HTML5) to read in a file. I use the readAsBinaryString function in the FileReader to pass in the images file. Then on the FileReader.onload function I pass in the evt.target.result to the SHA256 method in the CryptoJs API. I am able to successfully get a hash value but it is not correct. When I pass in a text file, it works fine but not image file. Code(Should be able to copy the code below to a HTML file and run it on