salt

Spring security password hash + salt

我的梦境 提交于 2019-12-06 04:30:27
I am working with a legacy application that stored passwords in plaintext. I have ported the application to spring 3 mvc + security. I have also successfully gotten spring security handling the authentication and authorization using sha256 + a salt based on the username. This all works great, however as part of the deployment, I will need to migrate the existing database to use the new password schema. I am not sure how spring security does it's password hashing with a salt, so i am unable to write a sql script that can be used to migrate the old plaintext passwords to the new sha256+salt

Where is the best place to store the password salt for the website?

风格不统一 提交于 2019-12-06 02:13:57
问题 I have two salts, each user has a unique salt that is stored with the user info in the database. The second salt is one that is specific to the website. Both are needed to hash the passwords. Problem is I don't know where I should keep my website salt. Right now it resides in the PHP method that runs the hashing algorithm. Should I keep it in a file outside the /var/www/ and have PHP open and read the file? I don't want to store it in the database because that would defeat the purpose of

how to get/set the salt for a JdbcRealm

故事扮演 提交于 2019-12-06 01:53:07
I am attempting to use the Shiro JdbcRealm and SHA256 hashedcredentialsMatcher. I need to update a legacy database and assign the appropriate salt for each user (via a batch routine). how do I get/set the salt for a given account using the Shiro framework? Max With Shiro 1.2.3 all you need to do is: Extend JdbcRealm and set salt style. public class JdbcSaltRealm extends JdbcRealm { public JdbcSaltRealm() { setSaltStyle(SaltStyle.COLUMN); } } Update shiro.ini to use extended realm and to get salt column from DB credentialsMatcher = org.apache.shiro.authc.credential.HashedCredentialsMatcher

Android: Do the random SALT bytes passed to AESObfuscator need to stay the same?

自作多情 提交于 2019-12-05 23:31:34
问题 I'm implementing licensing in my Android application, and there is an array of 20 bytes that need to be passed into the AESObfuscator that is passed to the ServerManagedPolicy object. Can this array be generated randomly every time the code is ran, or does it have to be hardcoded? Right now I'm randomly generating the salt like this: private static final byte[] SALT; static { Random random = new Random(); random.setSeed(System.currentTimeMillis()); byte[] buf = new byte[20]; random.nextBytes

How to compare version strings in salt sls files

穿精又带淫゛_ 提交于 2019-12-05 21:33:12
Does saltstack have an equivalent to puppets versioncmp() function? Or alternatively, is there a way to get the distutils.version or packaging.version.parse methods (as mentioned on Compare version strings in Python ) available in a jinja+yaml rendered sls file? you can use the module pkg.version_cmp : # salt-call pkg.version_cmp '1.0.2' '1.1.1' local: -1 # salt-call pkg.version_cmp '0.2.4.1-0ubuntu1' '0.2.4-0ubuntu1' local: 1 Inside jinja you can use it in a way similar to: {% if salt['pkg.version_cmp']('1.1.0','1.0.5') > 0 %} .... {% endif %} 来源: https://stackoverflow.com/questions/45701907

PHP password_hash function salt length 21 or 22?

落花浮王杯 提交于 2019-12-05 17:55:13
Code: echo password_hash("stackoverflow", PASSWORD_DEFAULT, ['salt' => 'twenty-one-characters'] ); Result: Warning: password_hash(): Provided salt is too short: 21 expecting 22 code: echo password_hash("stackoverflow", PASSWORD_DEFAULT, ['salt' => 'twenty-one-charactersA'] ); Result: $2y$10$dHdlbnR5LW9uZS1jaGFyYOVyX13hK9eb4/KXMAkHsAJX..YR7t/32 code: echo password_hash("stackoverflow", PASSWORD_DEFAULT, ['salt' => 'twenty-one-charactersB'] ); $2y$10$dHdlbnR5LW9uZS1jaGFyYOVyX13hK9eb4/KXMAkHsAJX..YR7t/32 Question: As you see, by appending A and B to 21 character strings we created two different

node.js how to repreduce PHP MD5 encryption

半城伤御伤魂 提交于 2019-12-05 16:06:57
I'm converting an existing php based website to a node.js app, and I need to reproduce this encryption method from php to js. private static $_passwordSalt = 'd2g6IOP(U(&§)%U§VUIPU(HN%V/§§URerjh0ürfqw4zoöqe54gß0äQ"LOU$3wer'; public static function getCryptedPassword($password = 'password') { return sha1(md5(self::$_passwordSalt.$password)); } So far I've tried this but it does not return the same results: UserSchema.methods.hashPassword = function(password) { var salt = 'd2g6IOP(U(&§)%U§VUIPU(HN%V/§§URerjh0ürfqw4zoöqe54gß0äQ"LOU$3wer' var md5Hash = md5(password + salt); var

Rails 3 / Devise: Password salt no longer being created?

允我心安 提交于 2019-12-05 12:00:36
问题 I've been working on a project for a while now which uses Devise for user authentication. Whenever a user was created, it would generate a password salt for them along with their encrypted password. As I'm coming to the tail end of this project, I was testing user registration and noticed that my new roles were not creating a password salt in the database for these new users, whereas my older users all had salts. The new users can sign in fine, yet I'm concerned why Devise is no longer

Spring Security salt for custom UserDetails

拜拜、爱过 提交于 2019-12-05 08:07:18
I would like to add salt like: PasswordEncoder encoder = new ShaPasswordEncoder(); userDetails.setPassword(encoder.encodePassword(userDetails.getPassword(),saltSource.getSalt(userDetails)); as far userDetails is instance of my custom UserDetail class,i obliged to cast it to this spring class: UserDetails ,but as it's logically expected i got in Runtime: java.lang.ClassCastException: model.UserDetails cannot be cast to org.springframework.security.core.userdetails.UserDetails config: <beans:bean id="saultSource" class="org.springframework.security.authentication.dao.ReflectionSaltSource">

Salting a C# MD5 ComputeHash on a stream

丶灬走出姿态 提交于 2019-12-05 05:15:34
问题 I can't see any way to salt a MD5.ComputeHash(Stream). Am I missing some way of injecting bytes into the HashAlgorithm? I tried performing a ComputeHash(byte[]) before performing the stream compute, but, unsurprisingly, it had no effect. Any ideas (apart from modifying the file)? Thanks for your time. addendum Just to be a little more specific, I want to use a stream to get a hash on a large file that I don't want to load into memory. FileInfo myFI= new FileInfo("bigfile.dat"); FileStream