Verified Owner
Top Description Fields Constructors Methods
org.jabref.logic.shared.security

public Class Password

extends Object
Class Inheritance
Imports
java.io.UnsupportedEncodingException, java.nio.charset.StandardCharsets, java.security.GeneralSecurityException, .MessageDigest, .NoSuchAlgorithmException, java.util.Arrays, .Base64, javax.crypto.Cipher, .NoSuchPaddingException, javax.crypto.spec.IvParameterSpec, .SecretKeySpec

Password contains methods which are useful to encrypt and decrypt passwords using symetric algorithms.

Field Summary

Modifier and TypeField and Description
private final Cipher
private final IvParameterSpec
private final byte[]
private final SecretKeySpec

Constructor Summary

AccessConstructor and Description
public
Password(char[]
Phrase which should be encrypted or decrypted
phrase
,
String
Key which is used to improve symmetric encryption
key
)

public
Password(String phrase, String key)

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

Decrypted phrase/password
decrypt
()

Decrypts the set phrase/password which was encrypted via Password#encrypt().

public String

Returns:

Encrypted phrase/password
encrypt
()

Encrypts the set phrase/password with a symmetric encryption algorithm.

private byte[]
get128BitHash(byte[] byteArrayToHash)

Returns a 128 bit hash using SHA-256.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cipherback to summary
private final Cipher cipher
ivSpecback to summary
private final IvParameterSpec ivSpec
phraseback to summary
private final byte[] phrase
secretKeyback to summary
private final SecretKeySpec secretKey

Constructor Detail

Passwordback to summary
public Password(char[] phrase, String key) throws NoSuchAlgorithmException, NoSuchPaddingException
Parameters
phrase:char[]

Phrase which should be encrypted or decrypted

key:String

Key which is used to improve symmetric encryption

Passwordback to summary
public Password(String phrase, String key) throws NoSuchAlgorithmException, NoSuchPaddingException

Method Detail

decryptback to summary
public String decrypt() throws GeneralSecurityException, UnsupportedEncodingException

Decrypts the set phrase/password which was encrypted via Password#encrypt().

Returns:String

Decrypted phrase/password

encryptback to summary
public String encrypt() throws GeneralSecurityException, UnsupportedEncodingException

Encrypts the set phrase/password with a symmetric encryption algorithm.

Returns:String

Encrypted phrase/password

get128BitHashback to summary
private byte[] get128BitHash(byte[] byteArrayToHash) throws NoSuchAlgorithmException

Returns a 128 bit hash using SHA-256.