encryption

Laravel - LIKE operator to search for encrypted values

喜欢而已 提交于 2021-01-27 23:03:44
问题 I am trying to implement a search module in my Laravel app that could filter users by name. In order to protect users, the 'name' column rows are encrypted on DB. The problem that I am facing is that query below always returns 0 results. I am encrypting the search input value before searching into DB. $patients = DB::select( DB::raw("SELECT * FROM patient WHERE name LIKE '%".Crypt::encrypt($searchText)."%';")); What am I doing wrong here ? 回答1: Crypt::encrypt("Text") The above will rarely

Laravel - LIKE operator to search for encrypted values

ぃ、小莉子 提交于 2021-01-27 21:36:33
问题 I am trying to implement a search module in my Laravel app that could filter users by name. In order to protect users, the 'name' column rows are encrypted on DB. The problem that I am facing is that query below always returns 0 results. I am encrypting the search input value before searching into DB. $patients = DB::select( DB::raw("SELECT * FROM patient WHERE name LIKE '%".Crypt::encrypt($searchText)."%';")); What am I doing wrong here ? 回答1: Crypt::encrypt("Text") The above will rarely

Is there any way to generate PSS padded signatures in PHP?

元气小坏坏 提交于 2021-01-27 20:40:43
问题 In PHP, I want to sign some documents with a padding of PSS, and a digest of SHA512. According to the docs, at http://www.php.net/manual/en/function.openssl-sign.php, I can set the digest however I need, by using a string, such as openssl_sign($text-to-sign,$binary_signature,$privkey,"sha512"); I don't see any way to set the padding, however. Can anyone please help me understand how I can sign text, using the RSA-PSS padding style, as seen in version 2.1 of PKCS #1? 回答1: In order not to be

Pycrypto AES GCM encryption and Java decryption

删除回忆录丶 提交于 2021-01-27 20:39:04
问题 I'm using Pycryptodome (a PyCrypto fork) to create AES-GCM ciphertexts. I use the following Python code to encrypt: cek = os.urandom(16) nonce = os.urandom(12) cipher = AES.new(cek, AES.MODE_GCM, nonce=nonce, mac_len=16) ciphertext = cipher.encrypt(message) I then pass this to Java to decrypt: byte[] nonce = new byte[12]; Cipher cipher = Cipher.getInstance("AES/GCM/NoPadding"); GCMParameterSpec gcmSpec = new GCMParameterSpec(128, iv); SecretKeySpec secretKeySpec = new SecretKeySpec(cek, "AES"

FormsAuthentication Decrypt In Asp.Net Core

ε祈祈猫儿з 提交于 2021-01-27 20:18:08
问题 We have multiple Asp.Net MVC application's with Single Sign On where we pass encrypted string using FormsAuthentication.Encrypt() method and pass it as a query string and decrypt the same string using FormsAuthentication.Decrypt(). Since both sites were developed in Asp.Net MVC we are able to use Forms Authentication and able to decrypt the string. Now we are developing a new project in Asp.Net Core where we pass a encrypted string as query string from Asp.Net MVC and have to decrypt in Asp

Encrypting with AES-256 and PKCS7 padding

自作多情 提交于 2021-01-27 18:17:18
问题 I want to use python to encrypt some data and have come across pycrypto as a possible tool. In order to encrypt the data, I need to: Input passphrase string SHA-256 the string, giving key for AES-256 Represent sensitive data as string of 9 digit characters (ascii), with leading ascii 0s if present (the data will always be in this format). Encrypt data string using AES-256, NO SALT, using PKCS7 padding from RFC2315, in ecb mode. Represent ciphertext as Base64 (RFC 4648), needing 24 characters

SQL Always Encrypted in Azure

时光毁灭记忆、已成空白 提交于 2021-01-27 18:01:32
问题 I need to build a web app that accesses some encrypted columns on a DB. All must be hosted in the client's azure account. I have searched for a couple of days and read a lot of tutorials but I can't find an answer to my problem. I have mainly followed these: https://docs.microsoft.com/en-us/azure/sql-database/sql-database-always-encrypted http://www.bradleyschacht.com/always-encrypted-with-azure-key-vault/ I was able to run a web app on my machine with the certificate generated by SSMS

Is It Ever Recommended To Use The ECB Cipher Mode?

梦想的初衷 提交于 2021-01-27 14:11:26
问题 Judging from this Wikipedia article on cipher modes and other things I've heard about ECB, it's a big no-no and can leak information about your encrypted data. However, there are still plenty of examples out there on the 'net that utilize ECB: One of the top Google results for a Triple DES sample in .NET One of the answers to this question Is it ever acceptable or advantageous to use ECB? If the data is very small (one block) and you're using both a salt and an IV , is it OK? If so, where is

DECRYPTBYPASSPHRASE is not working after creating them with EncryptByPassPhrase

℡╲_俬逩灬. 提交于 2021-01-27 13:32:47
问题 I have a table: CREATE TABLE TempHashedValues( HashedValues varbinary(200) ) Now, I am inserting encrypted values to it using, so that could be used later: Insert into TempHashedValues values ( EncryptByPassPhrase('key', 'SecretEncoded' )) Now when I am trying to decrypt them using same key: Select TOP 1 DECRYPTBYPASSPHRASE('key',HashedValues) from TempHashedValues I am just getting the binary value back , not the value I encrypted !! What am I missing? 回答1: As stated here http://sqlity.net

Decrypting the signature created by RSACryptoServiceProvider.SignData() to get the hash

断了今生、忘了曾经 提交于 2021-01-27 13:04:52
问题 I'm trying to retrieve the hash created with the RSACryptoServiceProvider class' SignData and SignHash methods. I need this to be able to store encrypted hashes that must be retrieved later because they're part of a hash chain. Initially I wanted to encrypt and decrypt hashes manually, using the private key for encryption, but the library doesn't allow it. I can't find a method that does this, and all my searches have returned answers about how private key encryption is a bad idea (when not