Skip to content

Commit

Permalink
Switched to hex encoding for encrypted credentials.
Browse files Browse the repository at this point in the history
  • Loading branch information
neuged committed Mar 21, 2018
1 parent eaa7690 commit 963d833
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main/java/benchly/model/StorageCredential.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import javax.crypto.spec.PBEKeySpec;

import org.apache.shiro.codec.Base64;
import org.apache.shiro.codec.Hex;
import org.apache.shiro.crypto.AesCipherService;
import org.apache.shiro.crypto.SecureRandomNumberGenerator;
import org.slf4j.Logger;
Expand Down Expand Up @@ -54,8 +55,8 @@ protected StorageCredential(String plainCredential) {
// encrypt the credential using the key
AesCipherService aes = new AesCipherService();
aes.setKeySize(keySize);
this.encryptedCredential = aes.encrypt(plainCredential.getBytes(), key.getEncoded()).toBase64();
this.salt = new String(Base64.encode(saltBytes));
this.encryptedCredential = aes.encrypt(plainCredential.getBytes(), key.getEncoded()).toHex();
this.salt = Hex.encodeToString(saltBytes);
}

public String getEnryptedCredential() {
Expand Down

0 comments on commit 963d833

Please sign in to comment.