Java Code Examples for org.gluu.util.security.StringEncrypter#instance()

The following examples show how to use org.gluu.util.security.StringEncrypter#instance() . 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: AppInitializer.java    From oxTrust with MIT License 6 votes vote down vote up
@Produces
@ApplicationScoped
public StringEncrypter getStringEncrypter() throws OxIntializationException {
	String encodeSalt = configurationFactory.getCryptoConfigurationSalt();

	if (StringHelper.isEmpty(encodeSalt)) {
		throw new OxIntializationException("Encode salt isn't defined");
	}

	try {
		StringEncrypter stringEncrypter = StringEncrypter.instance(encodeSalt);

		return stringEncrypter;
	} catch (EncryptionException ex) {
		throw new OxIntializationException("Failed to create StringEncrypter instance");
	}
}
 
Example 2
Source File: AppInitializer.java    From oxAuth with MIT License 6 votes vote down vote up
@Produces
@ApplicationScoped
public StringEncrypter getStringEncrypter() {
	String encodeSalt = configurationFactory.getCryptoConfigurationSalt();

	if (StringHelper.isEmpty(encodeSalt)) {
		throw new ConfigurationException("Encode salt isn't defined");
	}

	try {
		StringEncrypter stringEncrypter = StringEncrypter.instance(encodeSalt);

		return stringEncrypter;
	} catch (EncryptionException ex) {
		throw new ConfigurationException("Failed to create StringEncrypter instance");
	}
}
 
Example 3
Source File: UtilsTest.java    From oxd with Apache License 2.0 4 votes vote down vote up
@Test(enabled = false)
public void decrypt() throws StringEncrypter.EncryptionException {
    StringEncrypter stringEncrypter = StringEncrypter.instance("123456789012345678901234");
    System.out.println(stringEncrypter.decrypt(""));
}