From: Daniel F. <dfe...@us...> - 2009-01-28 02:27:16
|
Hello, Yes, if some passwords aren't encrypted, but hibernate is being told to decrypt then, decryption will raise an exception (as the stored data is not a valid encrypted text). ConfigurablePasswordEncryptor, in spite of its name, creates digests (not "encrypted" texts), which means that its results cannot be "decrypted" back into its original shapes. The class is called that way to avoid confusion in users who are used to call "encryption" to what is in fact "digesting" or "hashing" (org.jasypt.util.* classes are supposed to be easily understandable without much knowledge...) For a better understanding of how password digesting (improperly called "encryption") works, have a look at http://www.jasypt.org/howtoencryptuserpasswords.html Regards, Daniel. bornleo wrote: > +------------------------+ > Jasypt Users List > http://www.jasypt.org > +------------------------+ > > Daniel, > > Thank you very much for your response. > > Few user passwords weren't encrypted could that be causing the issue? Is it > because hibernate pojos expects then to be encrypted because of the > annotation entry. > > One more thing i have read that we use the digest value to match the > credentials rather than encrypted value.How can we achieve that with > ConfigurablePasswordEncryptor? > > Kind regards, > Leo > > > > > dfernandez wrote: > >> +------------------------+ >> Jasypt Users List >> http://www.jasypt.org >> +------------------------+ >> >> Hello, >> >> Possible reasons for this are: database column too short for encrypted >> data (which corrupts it), and algorithm/password/configuration mismatch >> between the data already encrypted in the BD and the decryptor you are >> using (for example, if the data already in the database was encrypted >> with a different system). >> >> Regards, >> Daniel. >> >> >> >> bornleo wrote: >> >>> +------------------------+ >>> Jasypt Users List >>> http://www.jasypt.org >>> +------------------------+ >>> >>> Hi All, >>> >>> I just started working on JASYPT.I am trying it with my present >>> application >>> with Hibernate Annotation + Spring.I have found few examples on google, I >>> tried my best to follow them but i am struck with an issue. >>> >>> As Hibernate session factory is configured in my applicationContext so i >>> have made these entries there : >>> >>> <bean id="strongEncryptor" >>> class="org.jasypt.encryption.pbe.StandardPBEStringEncryptor"> >>> <property name="algorithm"> >>> <value>PBEWithMD5AndTripleDES</value> >>> </property> >>> <property name="password"> >>> <value>jasypt</value> >>> </property> >>> </bean> >>> <bean id="hibernateStringEncryptor" >>> class="org.jasypt.hibernate.encryptor.HibernatePBEStringEncryptor"> >>> <property name="registeredName"> >>> <value>hibernateStringEncryptor</value> >>> </property> >>> <property name="encryptor"> >>> <ref bean="strongEncryptor" /> >>> </property> >>> </bean> >>> >>> As the password i am using is to be encrypted so in my uSer model class i >>> have made these enteries: >>> >>> >>> @TypeDef( >>> name="encryptedString", >>> typeClass=EncryptedStringType.class, >>> parameters= { >>> @Parameter(name="encryptorRegisteredName", >>> value="hibernateStringEncryptor") >>> } >>> ) >>> >>> @Type(type="encryptedString") >>> @Column(name = "Encrypted_Password", length = 1000) >>> public String getEncryptedPassword() { >>> return this.encryptedPassword; >>> } >>> >>> >>> >>> And in my login class i am trying to fetch user data by >>> findByUserName(usrname); method >>> >>> and it gives me : >>> >>> ERROR UserDAO:96 - find by property name failed >>> org.jasypt.exceptions.EncryptionOperationNotPossibleException >>> at >>> org.jasypt.encryption.pbe.StandardPBEByteEncryptor.decrypt(StandardPBEByteEncryptor.java:742) >>> at >>> org.jasypt.encryption.pbe.StandardPBEStringEncryptor.decrypt(StandardPBEStringEncryptor.java:639) >>> at >>> org.jasypt.hibernate.type.AbstractEncryptedAsStringType.nullSafeGet(AbstractEncryptedAsStringType.java:144) >>> at org.hibernate.type.CustomType.nullSafeGet(CustomType.java:105) >>> at org.hibernate.type.AbstractType.hydrate(AbstractType.java:81) >>> at >>> org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2096) >>> >>> >>> >>> Please help it is very urgent :( >>> Leo >>> >>> >>> >>> >> ------------------------------------------------------------------------------ >> This SF.net email is sponsored by: >> SourcForge Community >> SourceForge wants to tell your story. >> http://p.sf.net/sfu/sf-spreadtheword >> _______________________________________________ >> jasypt-users mailing list >> jas...@li... >> https://lists.sourceforge.net/lists/listinfo/jasypt-users >> >> >> > > |