cryptography

Does Asp support Hash (bcrypt) Passwords like in PHP

点点圈 提交于 2019-12-24 06:44:55
问题 Is there a way to use Hash (bcrypt) Passwords in ASP like in PHP... the following would be the code for PHP but what is the alternative for ASP .. is it the same and just change things around? does ASP support Hash(bcrypt) or is there other way to do ? please engliten me with this situation... PHP would be $link = mysql_connect('localhost', 'wpscanner', 'aUvmxcxvTUPtW8Kw') or die('Not connected : ' . mysql_error()); mysql_select_db('wpscanner', $link) or die ('Not selected : ' . mysql_error()

How to encrypt with MCRYPT_ARCFOUR in WAMP?

早过忘川 提交于 2019-12-24 06:38:12
问题 I'm trying to use ARCFOUR algorithm in my PHP code: $td = mcrypt_module_open(MCRYPT_ARCFOUR, '', MCRYPT_MODE_CBC, ''); $iv = mcrypt_create_iv (mcrypt_enc_get_iv_size($td), MCRYPT_RAND); mcrypt_generic_init($td, $key, $iv); $output = mcrypt_generic($td, $input); mcrypt_generic_deinit($td); mcrypt_module_close($td); and the problem is that the first line returns warning: mcrypt_module_open(): Could not open encryption module My settings: From php_info() output: command configure: ... "--with

How can I decrypt data encrypted by Node's deprecated createCipher, in Ruby?

北城余情 提交于 2019-12-24 06:13:25
问题 I have some legacy data, encrypted in Node, which I need to decrypt in Ruby. The problem is, the data was encrypted with a now deprecated method, createCipher. This method uses a password to perform encryption. It has been replaced by createCipheriv, which requires a 32 byte key and a 16 byte initialization vector. In Node, I can decrypt the string with the similarly deprecated createDecipher, which also accepts a password. However, I'm not aware of any equivalent method in Ruby, which makes

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

RSA private exponent determination

对着背影说爱祢 提交于 2019-12-24 05:11:49
问题 My question is about RSA signing. In case of RSA signing: encryption -> y = x^d mod n, decryption -> x = y^e mod n x -> original message y -> encrypted message n -> modulus (1024 bit) e -> public exponent d -> private exponent I know x, y, n and e. Knowing these can I determine d? 回答1: If you can factor n = p*q, then d*e ≡ 1 (mod m) where m = φ(n) = (p-1)*(q-1), (φ(m) is Euler's totient function) in which case you can use the extended Euclidean algorithm to determine d from e. (d*e - k*m = 1

RSA private exponent determination

笑着哭i 提交于 2019-12-24 05:10:32
问题 My question is about RSA signing. In case of RSA signing: encryption -> y = x^d mod n, decryption -> x = y^e mod n x -> original message y -> encrypted message n -> modulus (1024 bit) e -> public exponent d -> private exponent I know x, y, n and e. Knowing these can I determine d? 回答1: If you can factor n = p*q, then d*e ≡ 1 (mod m) where m = φ(n) = (p-1)*(q-1), (φ(m) is Euler's totient function) in which case you can use the extended Euclidean algorithm to determine d from e. (d*e - k*m = 1

I'm getting slightly different hmac signatures out of clojure and python

你离开我真会死。 提交于 2019-12-24 05:06:16
问题 The HMAC SHA1 signatures I'm getting from my python implementation and my clojure implementation are slightly different. I'm stumped as to what would cause that. Python implementation: import hashlib import hmac print hmac.new("my-key", "my-data", hashlib.sha1).hexdigest() # 8bcd5631480093f0b00bd072ead42c032eb31059 Clojure implementation: (ns my-project.hmac (:import (javax.crypto Mac) (javax.crypto.spec SecretKeySpec))) (def algorithm "HmacSHA1") (defn return-signing-key [key mac] "Get an

Generate AES key on node

荒凉一梦 提交于 2019-12-24 04:16:08
问题 I'm dealing with a legacy application that uses a custom protocol to cipher communication. Random AES keys are generated in legacy Java app like this: keygen = KeyGenerator.getInstance("AES"); keygen.init(128); keygen.generateKey().getEncoded(); I've been looking for solutions on crypto with no luck. How can I generate this key on nodejs? 回答1: That code probably does not do as much as you think. It simply generates 16 (128 / 8) secure random bytes, then wraps a key object around it. So with

Convert java.security “NONEwithRSA” signature into BouncyCastle lightweight API

ⅰ亾dé卋堺 提交于 2019-12-24 02:31:44
问题 I need to convert Java app into C# and therefore need to migrate from java.security API into BouncyCastle lightweight API. My working code (java.security) looks like this: private byte[] computeSignature(byte[] message, PrivateKey key) { Signature signature = Signature.getInstance("NONEwithRSA"); signature.initSign(privateKey); signature.update(message); return signature.sign(); } This is my verification: private void verifySignature(byte[] signature, byte[] message, PublicKey publicKey) {

Why does any length key work for RijndaelManaged?

末鹿安然 提交于 2019-12-24 02:17:02
问题 Regarding the method... RijndaelManaged.CreateDecryptor Method (Byte[], Byte[]) Here it says about the first parameter... The secret key to be used for the symmetric algorithm. The key size must be 128, 192, or 256 bits. But I can set the key to be any length string... var key = Encoding.UTF8.GetBytes("whetever..."); Why isn't it more fussy about the length of the byte array? And how does it determine which of the three key lengths to be used? 回答1: It isn't true that any key size works. Only