added missing functionality
This commit is contained in:
@@ -1,18 +1,15 @@
|
||||
package com.bib.essensbestellungsverwaltung;
|
||||
|
||||
import javax.crypto.SecretKeyFactory;
|
||||
import javax.crypto.spec.PBEKeySpec;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.SecureRandom;
|
||||
import java.security.spec.InvalidKeySpecException;
|
||||
import java.security.spec.KeySpec;
|
||||
import java.util.Arrays;
|
||||
import java.util.Base64;
|
||||
|
||||
/*
|
||||
@author Malte Schulze Hobeling
|
||||
*/
|
||||
|
||||
import javax.crypto.SecretKeyFactory;
|
||||
import javax.crypto.spec.PBEKeySpec;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.spec.InvalidKeySpecException;
|
||||
import java.security.spec.KeySpec;
|
||||
import java.util.Base64;
|
||||
|
||||
public class AccountMgr {
|
||||
/**
|
||||
* creates a user with createUser(...) and adds its id to the 'worker' table
|
||||
@@ -106,7 +103,7 @@ public class AccountMgr {
|
||||
//todo: find a better way to salt
|
||||
byte[] magicSalt = new byte[]{96, 13, 100, 85, -37, 52, -123, 86, -123, -92, 16, 15, -110, -42, -49, 0};
|
||||
KeySpec spec = new PBEKeySpec(pw.toCharArray(), magicSalt,310001,256);
|
||||
String hashedPw = null;
|
||||
String hashedPw;
|
||||
try {
|
||||
SecretKeyFactory factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1");
|
||||
byte[] hash = factory.generateSecret(spec).getEncoded();
|
||||
|
||||
Reference in New Issue
Block a user