Foren

Decrypting password

maryannec maryannec, geändert vor 18 Jahren.

Decrypting password

New Member Beiträge: 2 Beitrittsdatum: 14.06.05 Neueste Beiträge
How can I find the company Key in order to decrypt the password. We are using our own JAAS LogingModule class. <br /><br />Here is the code snippet that I&#39;m using. The decrypt method always fails since the Key returned by the company is always null.<br /><br />User user = UserLocalManagerUtil.getUserById(username);<br />Company company = CompanyManagerUtil.getCompany(user.getCompanyId());<br />String decryptedPassword = <br /> Encryptor.decrypt(company.getKeyObj(), new String(password));<br /><br />
kamakazi kamakazi, geändert vor 17 Jahren.

RE: Decrypting password

New Member Beiträge: 24 Beitrittsdatum: 18.07.06 Neueste Beiträge
Has anyone managed to decrept the database saved password? I need to decrept it.
Tod Thomas, geändert vor 17 Jahren.

RE: Decrypting password

Junior Member Beiträge: 57 Beitrittsdatum: 22.06.06 Neueste Beiträge
What encryption algorithm is being used in both of these cases?
thumbnail
Brian Chan, geändert vor 17 Jahren.

RE: Decrypting password

Liferay Master Beiträge: 753 Beitrittsdatum: 05.08.04 Neueste Beiträge
That's the right code. It shouldn't be returning null though. We're using that in several places in the core code. Which app server?
kamakazi kamakazi, geändert vor 17 Jahren.

RE: Decrypting password

New Member Beiträge: 24 Beitrittsdatum: 18.07.06 Neueste Beiträge
I am using Jboss with tomcat and Liferay Portal Enterprise 4.1.0
and this is how I am getting my company object

Company company = themeDisplay.getCompany(); could this be my problem?
kamakazi kamakazi, geändert vor 17 Jahren.

RE: Decrypting password

New Member Beiträge: 24 Beitrittsdatum: 18.07.06 Neueste Beiträge
I am sorry the company. getkey obj comes back with something. The algo is DES and this is the line where it fails

byte[] decryptedBytes = cipher.doFinal(encryptedBytes);

This is the exception I am getting
javax.crypto.IllegalBlockSizeException: Input length must be multiple of 8 when decrypting with padded cipher.

Please help.
Tod Thomas, geändert vor 17 Jahren.

RE: Decrypting password

Junior Member Beiträge: 57 Beitrittsdatum: 22.06.06 Neueste Beiträge
kamakazi kamakazi:
I am sorry the company. getkey obj comes back with something. The algo is DES and this is the line where it fails

byte[] decryptedBytes = cipher.doFinal(encryptedBytes);

This is the exception I am getting
javax.crypto.IllegalBlockSizeException: Input length must be multiple of 8 when decrypting with padded cipher.

Please help.


I believe that using DES as a padded block cipher you need to make sure that the target of your decryption (the ciphertext) is aligned on 8 bit boundries. If the ciphertext is less than 8 bits you'll need to pad it with something like binary 0's.

The message you got above seems to imply the ciphertext hasn't been padded up to 8 bits prior to the attempt to decrypt it.