encryption

Using assembly code written for 32-bit in 64-bit application

依然范特西╮ 提交于 2021-02-08 04:11:14
问题 Can I use the assembly routines for Serpent encryption in the link below written for 32-bit x86 from a 64-bit program on an x86-64 machine? That is, without launching a separate 32-bit process for it? If not, does anyone have a pointer to an optimized implementation of Serpent that works in both 32 and 64 bit (LGPL is OK but cannot use GPL since it's a commercial project)? http://gladman.plushost.co.uk/oldsite/cryptography_technology/serpent/serpent.asm 回答1: You will need to convert the

PHP : Decrypt password from hash

穿精又带淫゛_ 提交于 2021-02-08 02:19:56
问题 So, I successfully encrypt a password to password hash using this following code : class PassHash { // blowfish private static $algo = '$2a'; // cost parameter private static $cost = '$10'; // mainly for internal use public static function unique_salt() { return substr(sha1(mt_rand()), 0, 22); } // this will be used to generate a hash public static function hash($password) { return crypt($password, self::$algo . self::$cost . '$' . self::unique_salt()); } // this will be used to compare a

PHP : Decrypt password from hash

情到浓时终转凉″ 提交于 2021-02-08 02:18:28
问题 So, I successfully encrypt a password to password hash using this following code : class PassHash { // blowfish private static $algo = '$2a'; // cost parameter private static $cost = '$10'; // mainly for internal use public static function unique_salt() { return substr(sha1(mt_rand()), 0, 22); } // this will be used to generate a hash public static function hash($password) { return crypt($password, self::$algo . self::$cost . '$' . self::unique_salt()); } // this will be used to compare a

How would you implement a secure static login credentials system in Java?

时光毁灭记忆、已成空白 提交于 2021-02-07 20:28:36
问题 We recently had a security audit and it exposed several weaknesses in the systems that are in place here. One of the tasks that resulted from it is that we need to update our partner credentials system make it more secure. The "old" way of doing things was to generate a (bad) password, give it to the partner with an ID and then they would send that ID and a Base 64 encoded copy of that password in with all of their XML requests over https. We then decode them and validate them. These

Can the length of a CryptoStream be determined before decryption?

99封情书 提交于 2021-02-07 19:57:14
问题 Is it possible to get the final length of decrypted data before decrypting it? Here's an example: RijndaelManaged RMCrypto = new RijndaelManaged(); RMCrypto.Padding = PaddingMode.ISO10126; Response.Buffer = false; Response.ClearHeaders(); Response.ClearContent(); Response.AddHeader("Content-length", ??????); CryptoStream crypto = new CryptoStream(Response.OutputStream, RMCrypto.CreateDecryptor(Key, IV), CryptoStreamMode.Write); using (Stream orig = GetDataStream()) { int bufferSize = 100000;

Can the length of a CryptoStream be determined before decryption?

跟風遠走 提交于 2021-02-07 19:55:02
问题 Is it possible to get the final length of decrypted data before decrypting it? Here's an example: RijndaelManaged RMCrypto = new RijndaelManaged(); RMCrypto.Padding = PaddingMode.ISO10126; Response.Buffer = false; Response.ClearHeaders(); Response.ClearContent(); Response.AddHeader("Content-length", ??????); CryptoStream crypto = new CryptoStream(Response.OutputStream, RMCrypto.CreateDecryptor(Key, IV), CryptoStreamMode.Write); using (Stream orig = GetDataStream()) { int bufferSize = 100000;

Get DER-encoded public key

元气小坏坏 提交于 2021-02-07 19:39:18
问题 Using BounceCastle I have the following code working. It generates a keypair and return the ASN.1 DER-encoded format. //Generate new key var generator = new RsaKeyPairGenerator (); generator.Init (new KeyGenerationParameters (new SecureRandom (), 1024)); var keyPair = generator.GenerateKeyPair (); //Save private key for later use keyParameters = (RsaKeyParameters)keyPair.Private; //Export ASN.1 DER-encoded SubjectPublicKeyInfo info = SubjectPublicKeyInfoFactory.CreateSubjectPublicKeyInfo

Wildcard searching of encrypted data in a MySQL database?

放肆的年华 提交于 2021-02-07 12:54:17
问题 I am in the process of building a small web application which will hold around 10 pieces of information for every person inserted. Due to data protection the majority of this information must be encrypted. Using the CodeIgniter framework and the CodeIgniter encryption class I can encode the information on the application side before storing it in the database. The CodeIgniter encryption class uses PHP's mcrypt function along with the AES_256 cipher. The problem I have is that I need to allow

Spring Properties Decryption

时光毁灭记忆、已成空白 提交于 2021-02-07 11:44:05
问题 We have mix of some legacy spring apps which are not yet migrated to spring-boot or spring cloud and also spring boot apps. I am working on creating a Spring component that will automatically decrypt spring properties when the environment is loaded if the property value is encrypted and has a prefix. The properties can be in .properties files(for legacy apps) or in .yaml files(newer spring boot apps). The component should be able to decrypt any spring property regardless of the source, and

Java Sha1 in PHP

不问归期 提交于 2021-02-07 11:11:33
问题 How to get the this Java SHA1 Result in PHP ? // Generating the Signature - Java // import java.security.MessageDigest; // import org.apache.commons.codec.binary.Base64; String userId; String applicationKey; // E.g. "196087a1-e815-4bc4-8984-60d8d8a43f1d"; String applicationSecret; // E.g. "oYdgGRXoxEuJhGDY2KQ/HQ=="; long sequence; // fetch and increment last used sequence String toSign = userId + applicationKey + sequence + applicationSecret; MessageDigest messageDigest = MessageDigest