Java Code Examples for org.jasypt.encryption.pbe.StandardPBEByteEncryptor#setAlgorithm()
The following examples show how to use
org.jasypt.encryption.pbe.StandardPBEByteEncryptor#setAlgorithm() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestHibernateTypes.java From jasypt with Apache License 2.0 | 6 votes |
private void registerEncryptors() { StandardPBEStringEncryptor stringEncryptor = new StandardPBEStringEncryptor(); stringEncryptor.setAlgorithm("PBEWithMD5AndDES"); stringEncryptor.setPassword("jasypt-hibernate5-test"); StandardPBEByteEncryptor byteEncryptor = new StandardPBEByteEncryptor(); byteEncryptor.setAlgorithm("PBEWithMD5AndDES"); byteEncryptor.setPassword("jasypt-hibernate5-test"); StandardPBEBigIntegerEncryptor bigIntegerEncryptor = new StandardPBEBigIntegerEncryptor(); bigIntegerEncryptor.setAlgorithm("PBEWithMD5AndDES"); bigIntegerEncryptor.setPassword("jasypt-hibernate5-test"); StandardPBEBigDecimalEncryptor bigDecimalEncryptor = new StandardPBEBigDecimalEncryptor(); bigDecimalEncryptor.setAlgorithm("PBEWithMD5AndDES"); bigDecimalEncryptor.setPassword("jasypt-hibernate5-test"); HibernatePBEEncryptorRegistry registry = HibernatePBEEncryptorRegistry.getInstance(); registry.registerPBEStringEncryptor("hibernateStringEncryptor", stringEncryptor); registry.registerPBEByteEncryptor("hibernateByteEncryptor", byteEncryptor); registry.registerPBEBigIntegerEncryptor("hibernateBigIntegerEncryptor", bigIntegerEncryptor); registry.registerPBEBigDecimalEncryptor("hibernateBigDecimalEncryptor", bigDecimalEncryptor); }
Example 2
Source File: HibernatePBEByteEncryptor.java From jasypt with Apache License 2.0 | 5 votes |
/** * Sets the algorithm to be used by the internal encryptor, if a specific * encryptor has not been set with <tt>setEncryptor(...)</tt>. * * @param algorithm the algorithm to be set for the internal encryptor */ public void setAlgorithm(final String algorithm) { if (this.encryptorSet) { throw new EncryptionInitializationException( "An encryptor has been already set: no " + "further configuration possible on hibernate wrapper"); } final StandardPBEByteEncryptor standardPBEByteEncryptor = (StandardPBEByteEncryptor) this.encryptor; standardPBEByteEncryptor.setAlgorithm(algorithm); }
Example 3
Source File: HibernatePBEByteEncryptor.java From jasypt with Apache License 2.0 | 5 votes |
/** * Sets the algorithm to be used by the internal encryptor, if a specific * encryptor has not been set with <tt>setEncryptor(...)</tt>. * * @param algorithm the algorithm to be set for the internal encryptor */ public void setAlgorithm(final String algorithm) { if (this.encryptorSet) { throw new EncryptionInitializationException( "An encryptor has been already set: no " + "further configuration possible on hibernate wrapper"); } final StandardPBEByteEncryptor standardPBEByteEncryptor = (StandardPBEByteEncryptor) this.encryptor; standardPBEByteEncryptor.setAlgorithm(algorithm); }
Example 4
Source File: TestHibernateTypes.java From jasypt with Apache License 2.0 | 5 votes |
private void registerEncryptors() { StandardPBEStringEncryptor stringEncryptor = new StandardPBEStringEncryptor(); stringEncryptor.setAlgorithm("PBEWithMD5AndDES"); stringEncryptor.setPassword("jasypt-hibernate3-test"); StandardPBEByteEncryptor byteEncryptor = new StandardPBEByteEncryptor(); byteEncryptor.setAlgorithm("PBEWithMD5AndDES"); byteEncryptor.setPassword("jasypt-hibernate3-test"); HibernatePBEEncryptorRegistry registry = HibernatePBEEncryptorRegistry.getInstance(); registry.registerPBEStringEncryptor("hibernateStringEncryptor", stringEncryptor); registry.registerPBEByteEncryptor("hibernateByteEncryptor", byteEncryptor); }
Example 5
Source File: HibernatePBEByteEncryptor.java From jasypt with Apache License 2.0 | 5 votes |
/** * Sets the algorithm to be used by the internal encryptor, if a specific * encryptor has not been set with <tt>setEncryptor(...)</tt>. * * @param algorithm the algorithm to be set for the internal encryptor */ public void setAlgorithm(final String algorithm) { if (this.encryptorSet) { throw new EncryptionInitializationException( "An encryptor has been already set: no " + "further configuration possible on hibernate wrapper"); } final StandardPBEByteEncryptor standardPBEByteEncryptor = (StandardPBEByteEncryptor) this.encryptor; standardPBEByteEncryptor.setAlgorithm(algorithm); }
Example 6
Source File: HibernatePBEByteEncryptor.java From jasypt with Apache License 2.0 | 5 votes |
/** * Sets the algorithm to be used by the internal encryptor, if a specific * encryptor has not been set with <tt>setEncryptor(...)</tt>. * * @param algorithm the algorithm to be set for the internal encryptor */ public void setAlgorithm(final String algorithm) { if (this.encryptorSet) { throw new EncryptionInitializationException( "An encryptor has been already set: no " + "further configuration possible on hibernate wrapper"); } final StandardPBEByteEncryptor standardPBEByteEncryptor = (StandardPBEByteEncryptor) this.encryptor; standardPBEByteEncryptor.setAlgorithm(algorithm); }
Example 7
Source File: TestHibernateTypes.java From jasypt with Apache License 2.0 | 5 votes |
private void registerEncryptors() { StandardPBEStringEncryptor stringEncryptor = new StandardPBEStringEncryptor(); stringEncryptor.setAlgorithm("PBEWithMD5AndDES"); stringEncryptor.setPassword("jasypt-hibernate3-test"); StandardPBEByteEncryptor byteEncryptor = new StandardPBEByteEncryptor(); byteEncryptor.setAlgorithm("PBEWithMD5AndDES"); byteEncryptor.setPassword("jasypt-hibernate3-test"); HibernatePBEEncryptorRegistry registry = HibernatePBEEncryptorRegistry.getInstance(); registry.registerPBEStringEncryptor("hibernateStringEncryptor", stringEncryptor); registry.registerPBEByteEncryptor("hibernateByteEncryptor", byteEncryptor); }
Example 8
Source File: TestSpringConfiguration.java From jasypt with Apache License 2.0 | 4 votes |
public void testNamespace() throws Exception { StandardPBEByteEncryptor standardPBEByteEncryptor = new StandardPBEByteEncryptor(); standardPBEByteEncryptor.setPassword("jasypt"); standardPBEByteEncryptor.setAlgorithm("PBEWithMD5AndDES"); ByteEncryptor byteEncryptor = (ByteEncryptor) ctx.getBean(BYTE_ENCRYPTOR_BEAN_NAME); assertTrue(ArrayUtils.isEquals(new byte[] {5, 7, 13}, standardPBEByteEncryptor.decrypt(byteEncryptor.encrypt(new byte[] {5, 7, 13})))); StandardPBEStringEncryptor standardPBEStringEncryptor = new StandardPBEStringEncryptor(); standardPBEStringEncryptor.setPassword("jasypt"); standardPBEStringEncryptor.setAlgorithm("PBEWithMD5AndDES"); standardPBEStringEncryptor.setStringOutputType("hexadecimal"); StringEncryptor stringEncryptor = (StringEncryptor) ctx.getBean(STRING_ENCRYPTOR_BEAN_NAME); assertEquals("jasypt", standardPBEStringEncryptor.decrypt(stringEncryptor.encrypt("jasypt"))); StandardStringDigester standardStringDigester = new StandardStringDigester(); standardStringDigester.setAlgorithm("SHA-1"); standardStringDigester.setStringOutputType("hexa"); StringDigester stringDigester = (StringDigester) ctx.getBean(STRING_DIGESTER_BEAN_NAME); assertTrue(stringDigester.matches("jasypt", standardStringDigester.digest("jasypt"))); assertTrue(standardStringDigester.matches("jasypt", stringDigester.digest("jasypt"))); }
Example 9
Source File: EncryptedBinaryType.java From jasypt with Apache License 2.0 | 4 votes |
private synchronized void checkInitialization() { if (!this.initialized) { if (this.useEncryptorName) { final HibernatePBEEncryptorRegistry registry = HibernatePBEEncryptorRegistry.getInstance(); final PBEByteEncryptor pbeEncryptor = registry.getPBEByteEncryptor(this.encryptorName); if (pbeEncryptor == null) { throw new EncryptionInitializationException( "No big integer encryptor registered for hibernate " + "with name \"" + this.encryptorName + "\""); } this.encryptor = pbeEncryptor; } else { final StandardPBEByteEncryptor newEncryptor = new StandardPBEByteEncryptor(); newEncryptor.setPassword(this.password); if (this.algorithm != null) { newEncryptor.setAlgorithm(this.algorithm); } if (this.keyObtentionIterations != null) { newEncryptor.setKeyObtentionIterations( this.keyObtentionIterations.intValue()); } newEncryptor.initialize(); this.encryptor = newEncryptor; } this.initialized = true; } }
Example 10
Source File: EncryptedBinaryType.java From jasypt with Apache License 2.0 | 4 votes |
private synchronized void checkInitialization() { if (!this.initialized) { if (this.useEncryptorName) { final HibernatePBEEncryptorRegistry registry = HibernatePBEEncryptorRegistry.getInstance(); final PBEByteEncryptor pbeEncryptor = registry.getPBEByteEncryptor(this.encryptorName); if (pbeEncryptor == null) { throw new EncryptionInitializationException( "No big integer encryptor registered for hibernate " + "with name \"" + this.encryptorName + "\""); } this.encryptor = pbeEncryptor; } else { final StandardPBEByteEncryptor newEncryptor = new StandardPBEByteEncryptor(); newEncryptor.setPassword(this.password); if (this.algorithm != null) { newEncryptor.setAlgorithm(this.algorithm); } if (this.keyObtentionIterations != null) { newEncryptor.setKeyObtentionIterations( this.keyObtentionIterations.intValue()); } newEncryptor.initialize(); this.encryptor = newEncryptor; } this.initialized = true; } }
Example 11
Source File: EncryptedBinaryType.java From jasypt with Apache License 2.0 | 4 votes |
private synchronized void checkInitialization() { if (!this.initialized) { if (this.useEncryptorName) { final HibernatePBEEncryptorRegistry registry = HibernatePBEEncryptorRegistry.getInstance(); final PBEByteEncryptor pbeEncryptor = registry.getPBEByteEncryptor(this.encryptorName); if (pbeEncryptor == null) { throw new EncryptionInitializationException( "No big integer encryptor registered for hibernate " + "with name \"" + this.encryptorName + "\""); } this.encryptor = pbeEncryptor; } else { final StandardPBEByteEncryptor newEncryptor = new StandardPBEByteEncryptor(); newEncryptor.setPassword(this.password); if (this.algorithm != null) { newEncryptor.setAlgorithm(this.algorithm); } if (this.keyObtentionIterations != null) { newEncryptor.setKeyObtentionIterations( this.keyObtentionIterations.intValue()); } newEncryptor.initialize(); this.encryptor = newEncryptor; } this.initialized = true; } }
Example 12
Source File: EncryptedBinaryType.java From jasypt with Apache License 2.0 | 4 votes |
private synchronized void checkInitialization() { if (!this.initialized) { if (this.useEncryptorName) { final HibernatePBEEncryptorRegistry registry = HibernatePBEEncryptorRegistry.getInstance(); final PBEByteEncryptor pbeEncryptor = registry.getPBEByteEncryptor(this.encryptorName); if (pbeEncryptor == null) { throw new EncryptionInitializationException( "No big integer encryptor registered for hibernate " + "with name \"" + this.encryptorName + "\""); } this.encryptor = pbeEncryptor; } else { final StandardPBEByteEncryptor newEncryptor = new StandardPBEByteEncryptor(); newEncryptor.setPassword(this.password); if (this.algorithm != null) { newEncryptor.setAlgorithm(this.algorithm); } if (this.keyObtentionIterations != null) { newEncryptor.setKeyObtentionIterations( this.keyObtentionIterations.intValue()); } newEncryptor.initialize(); this.encryptor = newEncryptor; } this.initialized = true; } }