开发者

Decrypt liferay passwords

Currently playing with liferay and i wish to get the username and password.

i can get the username and encrpyted password, so i need to decrypt the password - i thought i could do this with:

Company company;
    try {
        company = CompanyUtil.findByPrimaryKey(user.getCompanyId());
        password = Encryptor.decrypt(company.getKeyObj(), password);
    } catch (NoSuchCompanyException e) {
        e.printStackTrace();
    } catch (SystemException e) {
        e.printStackTrace();
    } catch (EncryptorException e) {
        e.printStackTrace();
    }

This however returns with an encryptorexception that is:

com.liferay.util.EncryptorException: com.li开发者_C百科feray.util.EncryptorException: javax.crypto.IllegalBlockSizeException: Input length must be multiple of 8 when decrypting with padded cipher

I have posted on the liferay forums aswell, but was hoping someone here may also be able to help - i am currently trying to do this in hook form, would a portlet be a better idea?

Many Thanks


Liferay is hashing passwords, so there's no concept "decrypting" the password: It's technically impossible. You can brute force some matching parts, but not just decrypt it.

See some deeper discussion in the Liferay message boards. (This is too much to copy/paste here)

If you've also posted your question there, please post a link from your to this post (and/or vice version) if your thread adds value to the discussion


I thought (or hoped) Liferay uses hashing to encrypt the passwords. In this case, you would have to encrypt the given password using the same method and check against the saved one.

What is your purpose of decrypting the password? This determines in which place you would implement this - hook or portlet.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜