cryptography

OpenSSL decrypt error - Padding versus Raw

若如初见. 提交于 2019-12-22 04:31:49
问题 I am receiving an encrypted file and it's key from a partner. The Key has itself been encrypted using our Digital Certificate Public Key. When I attempt to decrypt the key using the following and our private key, I get a padding error as shown below: C:\openssl rsautl -decrypt -in xxxx_Key -inkey xxxxprivatekey.pem -hexdump -out aeskey.txt Loading 'screen' into random state - done RSA operation error 5612:error:0407109F:rsa routines:RSA_padding_check_PKCS1_type_2:pkcs decoding er ror:.\crypto

OpenSSL decrypt error - Padding versus Raw

99封情书 提交于 2019-12-22 04:31:18
问题 I am receiving an encrypted file and it's key from a partner. The Key has itself been encrypted using our Digital Certificate Public Key. When I attempt to decrypt the key using the following and our private key, I get a padding error as shown below: C:\openssl rsautl -decrypt -in xxxx_Key -inkey xxxxprivatekey.pem -hexdump -out aeskey.txt Loading 'screen' into random state - done RSA operation error 5612:error:0407109F:rsa routines:RSA_padding_check_PKCS1_type_2:pkcs decoding er ror:.\crypto

RSA_public_decrypt and MS Crypto API equivalent

懵懂的女人 提交于 2019-12-22 04:29:22
问题 I'm trying to develop a license verification solution. Licenses are encoded on server using OpenSSL's RSA_private_encrypt function. For Mac OX X I use RSA_public_decrypt and it works like a charm. On Windows I must use very tiny bit of code, so I can not link with OpenSSL or other lib AND I have to use MS Crypto API. I have spent several days trying to figure out what is wrong, but with no luck. I can successfully import public key, but here my success ends. I'm aware that I need to reverse

java Encrypt method equivalent in node js crypto [duplicate]

假如想象 提交于 2019-12-22 01:27:43
问题 This question already has answers here : Encrypt in node and decrypt in java (4 answers) Node.js decipher not works for other ciphers' ciphertext (1 answer) AES encryption in Node.js to match expected decryption in Python (1 answer) Closed 2 years ago . I have java encryption function code as public String encrypt(String Data, String keySet) throws Exception { byte[] keyByte = keySet.getBytes(); Key key = generateKey(keyByte); Cipher c = Cipher.getInstance("AES"); c.init(Cipher.ENCRYPT_MODE,

AES: how to detect that a bad password has been entered?

五迷三道 提交于 2019-12-22 01:17:20
问题 A text s has been encrypted with: s2 = iv + Crypto.Cipher.AES.new(Crypto.Hash.SHA256.new(pwd).digest(), Crypto.Cipher.AES.MODE_CFB, iv).encrypt(s.encode()) Then, later, a user inputs the password pwd2 and we decrypt it with: iv, cipher = s2[:Crypto.Cipher.AES.block_size], s2[Crypto.Cipher.AES.block_size:] s3 = Crypto.Cipher.AES.new(Crypto.Hash.SHA256.new(pwd2).digest(), Crypto.Cipher.AES.MODE_CFB, iv).decrypt(cipher) Problem: the last line works even if the entered password pw2 is wrong . Of

Salting with AES

自闭症网瘾萝莉.ら 提交于 2019-12-22 00:34:00
问题 I'm a bit of an encryption newbie, but need to encrypt sensitive personal data before storing in a database. I was planning to use AES with CBC, but also wanted to use a salt. I couldn't however find a way to do this (other than with BouncyCastle which my host is not prepared to allow for some reason) so I decided to add one myself by adding a random string to end of the text to be encrypted: SecretKeySpec skeySpec = new SecretKeySpec(key, "AES"); byte[] iv = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0

Use TripleDESCryptoServiceProvider class in Silverlight Application

≡放荡痞女 提交于 2019-12-22 00:24:14
问题 I use a web service to authenticate. And this web service use the TripleDes algorithm to encrypt to user name and password. Im my silverlight application I have to encrypt these value for calling web service but I can not add reference of System.Security.Cryptography dll. How can I use this dll file for Silverlight application? 回答1: There is no such thing as a System.Security.Cryptography dll. System.Security.Cryptography is a namespace present in several assemblies that Microsoft ships. In

Equivalent to PasswordDeriveBytes in openssl

陌路散爱 提交于 2019-12-21 23:42:34
问题 I have C# code as below: private static string password = "Password"; private static string salt = "SALT"; private static string hashAlgorithm = "SHA1"; private static int iterations = 2; var saltValueBytes = Encoding.UTF8.GetBytes(salt); var passwordKey = new PasswordDeriveBytes(password, saltValueBytes, hashAlgorithm, iterations) ... I need to implement the same in Mac, I came to know that Opnessl implements related methods(i.e. libcrypto). What is the equivalent method in Opnessl to above

How should I derive the key and initialization vector for my AES encrypted database entries?

久未见 提交于 2019-12-21 22:14:04
问题 I've built a CMS system to allow users to create and manage online forms on my client's intranet app. Of course some of the data handled by the forms may need to be encrypted e.g. if the system is used to build a form that handles salary specifics or whatever. So I'm using the AESManaged class to symmetrically encrypt this sort of data prior to it going into our application db. All is fine, but now, prior to release, I could do with a steer regarding the shared secret and salt . My original

Verify a hash generated with php crypt() in NodeJS?

三世轮回 提交于 2019-12-21 21:57:25
问题 I have a PHP 5.3 webserver with the Lithium framework running on it. I have password hashes generated with CRYPT_BLOWFISH : public static function hash($password, $salt = null) { return crypt($password, $salt ?: static::salt()); } They get checked with this : public static function check($password, $hash) { return String::compare(crypt($password, $hash), $hash); } I'm looking for the NodeJS script that would enable me to both check and generate similar hashes : I've tried this so far (check