* @param bookmarkingSource <tt>BookmarkingSource</tt> what source to get credentials for
* @return <tt>TaggingCredentials</tt> credentials of the given user for the given bookmarking source
* @throws BadCredentialsException when user's credentials where not found
*/
public TaggingCredential loadCredentials(String sscfPerson, BookmarkingSource bookmarkingSource) throws BadCredentialsException{
TaggingCredential credentials = null;
Person person = PersonFactory.getPerson(sscfPerson);
String[] encryptedCredentials = readFromStorage(person,bookmarkingSource);
if(person != null && encryptedCredentials != null){
String mbox_sha1sum = person.getMbox_sha1sum();
PBEKeySpec keySpec = new PBEKeySpec(mbox_sha1sum.toCharArray());
try {
BASE64Decoder decoder = new BASE64Decoder();
SecretKey secretKey = secretKeyFactory.generateSecret(keySpec);
PBEParameterSpec paramSpec = new PBEParameterSpec(loginSalt, ITERATIONS);
cipher.init(Cipher.DECRYPT_MODE, secretKey,paramSpec);
String secretLogin = URLDecoder.decode(encryptedCredentials[0],"UTF-8");
byte[] loginBytes = cipher.doFinal(decoder.decodeBuffer(secretLogin));
String login = new String(loginBytes);
paramSpec = new PBEParameterSpec(passwordSalt,ITERATIONS);
cipher.init(Cipher.DECRYPT_MODE,secretKey,paramSpec);
String secretPassword = URLDecoder.decode(encryptedCredentials[1],"UTF-8");
byte[] passwordBytes = cipher.doFinal(decoder.decodeBuffer(secretPassword));
String password = new String(passwordBytes);
credentials = new TaggingCredential(bookmarkingSource.getType(),login,password);
addToMap(sscfPerson,credentials);
return credentials;
} catch (InvalidKeySpecException e) {
logger.severe(e.getMessage());