Hi Am using hibernate3 and struts frame. hibernate annotation am using. in my project required password encryptio required for that we used jasypt. as per their website instruction followed but getting like
org.jasypt.exceptions.EncryptionInitializationException: No string encryptor registered for hibernate with name "strongHibernateEncryptor"
My hibernate.cfg.xml code <property name="connection.provider_class">org.jasypt.hibernate3.connectionprovider.EncryptedPasswordDriverManagerConnectionProvider </property> <property name="connection.encryptor_registered_name">strongHibernateEncryptor</property> <property name="hibernate.connection.driver_class">org.postgresql.Driver</property> <property name="hibernate.connection.url">jdbc:postgresql://127.0.0.1:5433/postgres</property> <property name="hibernate.connection.username">admin</property> <property name="connection.password">admin</property>
My Domain class is @Entity @Table(name = "USERS") @TypeDef ( name="encryptedString", typeClass=EncryptedStringType.class, parameters= { @Parameter (name="encryptorRegisteredName", value="strongHibernateEncryptor") } )
@Column(name = "USERS_PASSWORD", nullable = false, length = 12) @Type(type="encryptedString") public String getPassword() throws Exception { return password; }
public void setPassword(String password) throws Exception { System.out.println("password set method password: "+password); //String s = strongEncryptor.setPassword(password); StandardPBEStringEncryptor strongEncryptor = new StandardPBEStringEncryptor(); strongEncryptor.setAlgorithm("PBEWithMD5AndTripleDES"); strongEncryptor.setPassword(password); HibernatePBEEncryptorRegistry registry = HibernatePBEEncryptorRegistry.getInstance(); registry.registerPBEStringEncryptor("strongHibernateEncryptor", strongEncryptor); //registry.registerPBEStringEncryptor("strongHibernateStringEncryptor", strongEncryptor); strongEncryptor.setPassword(password); //String s = (strongEncryptor.setPassword(password)); this.password = password; System.out.println("password set method password: "+password); }
please help me to solve this issue
|