cryptography

Read encrypted php files using ajax

你说的曾经没有我的故事 提交于 2020-01-06 08:58:30
问题 I encrypt all my core files using libsodium, but my problem is how to read the php files in decrypted state like calling the file using ajax like automatic decryption. I'm not sure if its possible. Its something like this. Sorry, I'm still exploring on this library I work on this before but method is wrong, and told me to use libsodium. Hope you help me. ENCRYPTION <?php require_once('function.php'); if(isset($_FILES)){ $tmp = "enc/"; $tmpFiles = browseDir($tmp); foreach($tmpFiles as $file){

Read encrypted php files using ajax

这一生的挚爱 提交于 2020-01-06 08:58:28
问题 I encrypt all my core files using libsodium, but my problem is how to read the php files in decrypted state like calling the file using ajax like automatic decryption. I'm not sure if its possible. Its something like this. Sorry, I'm still exploring on this library I work on this before but method is wrong, and told me to use libsodium. Hope you help me. ENCRYPTION <?php require_once('function.php'); if(isset($_FILES)){ $tmp = "enc/"; $tmpFiles = browseDir($tmp); foreach($tmpFiles as $file){

Decrypting rfc2898 password

China☆狼群 提交于 2020-01-06 07:14:50
问题 I'm in the middle of development and I need to test my login/password api. Problem is in the database the password is encrypted. I have the following information. key iteration salt Is this enough to recover the password? By the way I can edit these values as well if that will help. 回答1: I think you misunderstood, how a password API works. You cannot reverse a properly hashed password, but you can validate an entered password against the stored hash. To validate the entered password, you need

Using PowerShell to decrypt a Python encrypted String

江枫思渺然 提交于 2020-01-06 06:51:25
问题 I am using a python program to take a large string (256 bytes or more) and encrypt it using AES-CBC. This would happen on a Linux system then the encrypted data would be transferred to a windows machine where it would be decrypted. I am able to encrypt the data in python, but cannot decrypt the data in PowerShell. I believe my issue is with the PowerShell code, but am not completely sure. In PowerShell I am getting a large string of ASCII characters as my output: IV is equal to 81 114 150 34

replace JCE with Bouncycastle jar

别来无恙 提交于 2020-01-06 05:07:09
问题 I have to get rid of JCE jars and should be replaced with bouncy castle jar for AES encryption and decryption. I am getting invalid key size exception when i replace JCE policy jars with BC jars for AES 256 algorithm. But it works well with key size 128. How can i make use of BC jars in case of AES 256 algorithm. Thanks. 回答1: This answer assumes that it is not possible to install the unlimited strength jurisdictional cryptography files using the scripting mentioned. The key size restraint of

crypto wrong AES-256-ecb encrypt

南楼画角 提交于 2020-01-06 04:56:07
问题 I tried to encrypt "aaaaaaaaaaa" in aes-256-ecb var encrypt = function(cryptkey, cleardata) { var encipher = crypto.createCipher('aes-256-ecb', cryptkey); return Buffer.concat([ encipher.update(cleardata), encipher.final() ]); } var hex_key = [0x2A,0x46,0x29,0x4A,0x40,0x4E,0x63,0x52,0x66,0x55,0x6A,0x58,0x6E,0x32,0x72, 0x35,0x75,0x38,0x78,0x2F,0x41,0x3F,0x44,0x28,0x47,0x2B,0x4B,0x61,0x50,0x64,0x53,0x67] var _text = new Buffer([0x61,0x61,0x61,0x61,0x61,0x61,0x61,0x61,0x61,0x61,0x61]) console

Parse RSA key pair from string in Python

我是研究僧i 提交于 2020-01-06 04:24:44
问题 I'm trying to generate/read a RSA-keypair from the publicKey and the privateKey as a String. Something like this: priK = "-----BEGIN RSA PRIVATE KEY-----MIIBOQIBAAJAVJhUS0gLqXLOmVv2xG23oFPwim9+rVxGhLUXqKShQCvB3iRMOHn7/GNJumpwmnglcsNXuqAhN0OxqKGGJdtYdwIDAQABAkBP0VrXnSbDvvuIX+k59Xvo3sp7FDAmSoaO+H9WM9+ht5H/f/geIrSEXSIkFLnzniMwtOJ422GmkDkL1F67HuDhAiEAlNauDiq3RqoXufbauyPEOG9fMS2pvB+auT2XCHJhhKsCIQCRgIo7WIRZYnNpNRWaoppUQK3g+aM8sdeBYpbs2nwDZQIgZXIxrmxFAUAb7d+oVFdbfc

Using a hash of data as a salt

有些话、适合烂在心里 提交于 2020-01-06 01:54:07
问题 I was wondering - is there any disadvantages in using the hash of something as a salt of itself? E.g. hashAlgorithm(data + hashAlgorithm(data)) This prevents the usage of lookup tables, and does not require the storage of a salt in the database. If the attacker does not have access to the source code, he would not be able to obtain the algorithm, which would make brute-forcing significantly harder. Thoughts? (I have a gut feeling that this is bad - but I wanted to check if it really is, and

How to find reverse of pow(a,b,c) in python?

一笑奈何 提交于 2020-01-05 08:22:12
问题 pow(a,b,c) operator in python returns (a**b)%c . If I have values of b , c , and the result of this operation (res=pow(a,b,c)) , how can I find the value of a ? 回答1: Despite the statements in the comments this is not the discrete logarithm problem. This more closely resembles the RSA problem in which c is the product of two large primes, b is the encrypt exponent, and a is the unknown plaintext. I always like to make x the unknown variable you want to solve for, so you have y = x b mod c

Unable to decrypt p7m using MimeKit

♀尐吖头ヾ 提交于 2020-01-05 07:38:27
问题 I have located my smime.p7m from my email message, I read it as stream and try to decrypt it using MimeKit, but it failed with Operation is not valid due to the current state of the object. using (MemoryStream ms = new MemoryStream(data)) { CryptographyContext.Register(typeof(WindowsSecureMimeContext)); ApplicationPkcs7Mime p7m = new ApplicationPkcs7Mime(SecureMimeType.EnvelopedData, ms); var ctx = new WindowsSecureMimeContext(StoreLocation.CurrentUser); p7m.Verify(ctx, out MimeEntity output)