当前位置: 首页>>代码示例>>Java>>正文


Java StandardPBEStringEncryptor类代码示例

本文整理汇总了Java中org.jasypt.encryption.pbe.StandardPBEStringEncryptor的典型用法代码示例。如果您正苦于以下问题:Java StandardPBEStringEncryptor类的具体用法?Java StandardPBEStringEncryptor怎么用?Java StandardPBEStringEncryptor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


StandardPBEStringEncryptor类属于org.jasypt.encryption.pbe包,在下文中一共展示了StandardPBEStringEncryptor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createFakeToken

import org.jasypt.encryption.pbe.StandardPBEStringEncryptor; //导入依赖的package包/类
public static String createFakeToken(String password, long validity,  Map<String, String> properties){
    try {
        StandardPBEStringEncryptor textEncryptor = new StandardPBEStringEncryptor();
        textEncryptor.setPassword(password);

        SimpleToken token = SimpleToken.of(validity, properties);

        String result = GeneralUtils.toJsonString(token);
        String encryptedResult = textEncryptor.encrypt(result);

        return encryptedResult;
    }
    catch(Exception ex){
        throw new RuntimeException(ex);
    }
}
 
开发者ID:drinkwater-io,项目名称:drinkwater-java,代码行数:17,代码来源:SimpleToken.java

示例2: initialize

import org.jasypt.encryption.pbe.StandardPBEStringEncryptor; //导入依赖的package包/类
private static void initialize() {
    final Properties dbProps = DbProperties.getDbProperties();

    if (EncryptionSecretKeyChecker.useEncryption()) {
        final String dbSecretKey = dbProps.getProperty("db.cloud.encrypt.secret");
        if (dbSecretKey == null || dbSecretKey.isEmpty()) {
            throw new CloudRuntimeException("Empty DB secret key in db.properties");
        }

        s_encryptor = new StandardPBEStringEncryptor();
        s_encryptor.setAlgorithm("PBEWithMD5AndDES");
        s_encryptor.setPassword(dbSecretKey);
    } else {
        throw new CloudRuntimeException("Trying to encrypt db values when encrytion is not enabled");
    }
}
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:17,代码来源:DBEncryptionUtil.java

示例3: initializeNewEngine

import org.jasypt.encryption.pbe.StandardPBEStringEncryptor; //导入依赖的package包/类
/**
 * Initialize engine for first time use. This method created a new random data encryption passphrase which is shown
 * to no one.
 */
private void initializeNewEngine() {
	// Generate a new data passphrase
	String newDataPassphrase = generateNewDataPassphrase();
	// Encrypt the data passphrase with the key passphrase
	final StandardPBEStringEncryptor dataPassEncryptor = new StandardPBEStringEncryptor();
	dataPassEncryptor.setProviderName(CryptoConstants.BOUNCY_CASTLE_PROVIDER_NAME);
	dataPassEncryptor.setAlgorithm(CryptoConstants.STRONG_ALGO);
	dataPassEncryptor.setPassword(getKeyPassphrase());
	String encryptedNewDataPassphrase = dataPassEncryptor.encrypt(newDataPassphrase);

	// Persist the new engine config
	try {
		MutableRepositoryItem newCryptoEngineItem = getCryptoRepository().createItem(getCryptoEngineIdentifier(),
				CryptoConstants.CRYPTO_ENGINE_ITEM_DESC);
		newCryptoEngineItem.setPropertyValue(CryptoConstants.DESCRIPTION_PROP_NAME, getCryptoEngineDescription());
		newCryptoEngineItem.setPropertyValue(CryptoConstants.ENC_DATA_KEY_PROP_NAME, encryptedNewDataPassphrase);
		newCryptoEngineItem.setPropertyValue(CryptoConstants.KEY_DATE_PROP_NAME, new Date());
		getCryptoRepository().addItem(newCryptoEngineItem);
	} catch (RepositoryException e) {
		if (isLoggingError()) {
			logError("CryptoEngine.initializeEngine: " + "unable to create new crypto engine config item.", e);
		}
	}
}
 
开发者ID:sparkred-insight,项目名称:ATGCrypto,代码行数:29,代码来源:CryptoEngine.java

示例4: initialize

import org.jasypt.encryption.pbe.StandardPBEStringEncryptor; //导入依赖的package包/类
private static void initialize() {
    final Properties dbProps = DbProperties.getDbProperties();

    if (EncryptionSecretKeyChecker.useEncryption()) {
        String dbSecretKey = dbProps.getProperty("db.cloud.encrypt.secret");
        if (dbSecretKey == null || dbSecretKey.isEmpty()) {
            throw new CloudRuntimeException("Empty DB secret key in db.properties");
        }

        s_encryptor = new StandardPBEStringEncryptor();
        s_encryptor.setAlgorithm("PBEWithMD5AndDES");
        s_encryptor.setPassword(dbSecretKey);
    } else {
        throw new CloudRuntimeException("Trying to encrypt db values when encrytion is not enabled");
    }
}
 
开发者ID:apache,项目名称:cloudstack,代码行数:17,代码来源:DBEncryptionUtil.java

示例5: DefinitionRequests

import org.jasypt.encryption.pbe.StandardPBEStringEncryptor; //导入依赖的package包/类
public DefinitionRequests(
		Application csapApp,
		CsapEventClient csapEventClient,
		SourceControlManager sourceControlManager,
		StandardPBEStringEncryptor encryptor,
		CsapEncryptableProperties csapEncProps,
		CorePortals corePortals ) {

	this.csapApp = csapApp;
	this.corePortals = corePortals;
	this.csapEventClient = csapEventClient;
	this.sourceControlManager = sourceControlManager;
	this.encryptor = encryptor;
	this.csapEncProps = csapEncProps;

}
 
开发者ID:csap-platform,项目名称:csap-core,代码行数:17,代码来源:DefinitionRequests.java

示例6: setUp

import org.jasypt.encryption.pbe.StandardPBEStringEncryptor; //导入依赖的package包/类
@Before
public void setUp ()
		throws Exception {
	//
	// File csapApplicationDefinition = new File(
	// getClass().getResource(
	// "/org/csap/test/data/test_application_model.json" ).getPath() );

	logger.info( "Loading test configuration: {}", InitializeLogging.DEFINITION_DEFAULT );
	Application.setJvmInManagerMode( false );
	csapApp = new Application();
	csapApp.setAutoReload( false );
	csapApp.initialize();

	assertThat( csapApp.loadDefinitionForJunits( false, InitializeLogging.DEFINITION_DEFAULT ) )
		.as( "No Errors or warnings" )
		.isTrue();

	encryptor = new StandardPBEStringEncryptor();
	encryptor.setPassword( "junittest" );
	sourceControlManager = new SourceControlManager( csapApp, encryptor );
}
 
开发者ID:csap-platform,项目名称:csap-core,代码行数:23,代码来源:Source_Control_Test.java

示例7: integrate

import org.jasypt.encryption.pbe.StandardPBEStringEncryptor; //导入依赖的package包/类
@Override
public void integrate(Metadata metadata, SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) {
    EventListenerRegistry service = serviceRegistry.getService(org.hibernate.event.service.spi.EventListenerRegistry.class);

    StandardPBEStringEncryptor encrypt = new StandardPBEStringEncryptor();
    encrypt.setPassword("test_password");
    RenderedMessageEncryptEventListener encryptListener = new RenderedMessageEncryptEventListener();
    encryptListener.setStringEncryptor(encrypt);

    RenderedMessageDecryptEventListener decryptListener = new RenderedMessageDecryptEventListener();
    decryptListener.setStringEncryptor(encrypt);

    FullTextIndexEventListener fullTextListener = new FullTextIndexEventListener();

    service.appendListeners(EventType.PRE_UPDATE, encryptListener);
    service.prependListeners(EventType.POST_UPDATE, decryptListener);
    service.appendListeners(EventType.PRE_INSERT, encryptListener);
    service.prependListeners(EventType.POST_INSERT, decryptListener);
    service.appendListeners(EventType.POST_LOAD, decryptListener);
}
 
开发者ID:oehf,项目名称:ipf-flow-manager,代码行数:21,代码来源:CustomEventRegistration.java

示例8: setup

import org.jasypt.encryption.pbe.StandardPBEStringEncryptor; //导入依赖的package包/类
@Before
public void setup() {

	StandardPBEStringEncryptor enc = new StandardPBEStringEncryptor();
	enc.setPassword("password"); // can be sourced out
	ConfigurationUtils.loadEncryptedConfigurationFile(enc, "botmill.properties");
	List<BotDefinition> botDefinitions = new ArrayList<BotDefinition>();
	botDefinitions.add(new AnnotatedDomain());
	ConfigurationUtils.setBotDefinitionInstance(botDefinitions);

	ConfigurationBuilder.getInstance().setWebhook("https://kik-bot-021415.herokuapp.com/kikbot")
			.setManuallySendReadReceipts(false).setReceiveDeliveryReceipts(false).setReceiveIsTyping(true)
			.setReceiveReadReceipts(false)
			.setStaticKeyboard(KeyboardBuilder.getInstance().addResponse(MessageFactory.createTextResponse("BODY"))
					.setType(KeyboardType.SUGGESTED).buildKeyboard())
			.buildConfiguration();

}
 
开发者ID:BotMill,项目名称:kik-botmill,代码行数:19,代码来源:IncomingToOutgoingMessageHandlerTest.java

示例9: setup

import org.jasypt.encryption.pbe.StandardPBEStringEncryptor; //导入依赖的package包/类
/**
 * Setup.
 */
@Before
public void setup() {
	
	StandardPBEStringEncryptor enc = new StandardPBEStringEncryptor();
	enc.setPassword("password"); // can be sourced out
	ConfigurationUtils.loadEncryptedConfigurationFile(enc, "botmill.properties");
	List<BotDefinition> botDefinitions = new ArrayList<BotDefinition>();
	botDefinitions.add(new AnnotatedDomain());
	ConfigurationUtils.setBotDefinitionInstance(botDefinitions);
	
	ConfigurationBuilder.getInstance()
		.setWebhook("https://kik-bot-021415.herokuapp.com/kikbot")
		.setManuallySendReadReceipts(false)
		.setReceiveDeliveryReceipts(false)
		.setReceiveIsTyping(true)
		.setReceiveReadReceipts(false)
		.setStaticKeyboard(
					KeyboardBuilder.getInstance()
					.addResponse(MessageFactory.createTextResponse("BODY"))
					.setType(KeyboardType.SUGGESTED).buildKeyboard())
		.buildConfiguration();
	
}
 
开发者ID:BotMill,项目名称:kik-botmill,代码行数:27,代码来源:IncomingMessageBuilderTest.java

示例10: setup

import org.jasypt.encryption.pbe.StandardPBEStringEncryptor; //导入依赖的package包/类
/**
 * Setup.
 */
@Before
public void setup() {
	
	StandardPBEStringEncryptor enc = new StandardPBEStringEncryptor();
	enc.setPassword("password"); // can be sourced out
	ConfigurationUtils.loadEncryptedConfigurationFile(enc, "botmill.properties");
	List<BotDefinition> botDefinitions = new ArrayList<BotDefinition>();
	botDefinitions.add(new AnnotatedDomain());
	ConfigurationUtils.setBotDefinitionInstance(botDefinitions);
	
	
	ConfigurationBuilder.getInstance()
		.setWebhook("https://kik-bot-021415.herokuapp.com/kikbot")
		.setManuallySendReadReceipts(false)
		.setReceiveDeliveryReceipts(false)
		.setReceiveIsTyping(true)
		.setReceiveReadReceipts(false)
		.buildConfiguration();
}
 
开发者ID:BotMill,项目名称:kik-botmill,代码行数:23,代码来源:JsonToActionFrameTest.java

示例11: setUp

import org.jasypt.encryption.pbe.StandardPBEStringEncryptor; //导入依赖的package包/类
/**
 * Sets the up.
 */
@Before
public void setUp() {
	
	StandardPBEStringEncryptor enc = new StandardPBEStringEncryptor();
	enc.setPassword("password"); // can be sourced out
	ConfigurationUtils.loadEncryptedConfigurationFile(enc, "botmill.properties");
	List<BotDefinition> botDefinitions = new ArrayList<BotDefinition>();
	botDefinitions.add(new AnnotatedDomain());
	ConfigurationUtils.setBotDefinitionInstance(botDefinitions);
	
	ConfigurationBuilder.getInstance()
			.setWebhook("https://kik-bot-021415.herokuapp.com/kikbot")
			.setManuallySendReadReceipts(false)
			.setReceiveDeliveryReceipts(false)
			.setReceiveIsTyping(true)
			.setReceiveReadReceipts(false)
			.buildConfiguration();
}
 
开发者ID:BotMill,项目名称:kik-botmill,代码行数:22,代码来源:OutgoingMessageBuilderTest.java

示例12: setUp

import org.jasypt.encryption.pbe.StandardPBEStringEncryptor; //导入依赖的package包/类
@Before
public void setUp() {
	
	StandardPBEStringEncryptor enc = new StandardPBEStringEncryptor();
	enc.setPassword("password"); // can be sourced out
	ConfigurationUtils.loadEncryptedConfigurationFile(enc, "botmill.properties");
	List<BotDefinition> botDefinitions = new ArrayList<BotDefinition>();
	botDefinitions.add(new AnnotatedDomain());
	ConfigurationUtils.setBotDefinitionInstance(botDefinitions);
	
	ConfigurationBuilder.getInstance()
			.setWebhook("https://kik-bot-021415.herokuapp.com/kikbot")
			.setManuallySendReadReceipts(false)
			.setReceiveDeliveryReceipts(false)
			.setReceiveIsTyping(true)
			.setReceiveReadReceipts(false)
			.buildConfiguration();
}
 
开发者ID:BotMill,项目名称:kik-botmill,代码行数:19,代码来源:BasicOutgoingMessageTest.java

示例13: main

import org.jasypt.encryption.pbe.StandardPBEStringEncryptor; //导入依赖的package包/类
public static void main(String[] args) {
	StandardPBEStringEncryptor enc = new StandardPBEStringEncryptor();
	enc.setPassword("password"); // can be sourced out
	ConfigurationUtils.loadEncryptedConfigurationFile(enc, "botmill.properties");
	
	List<BotDefinition> botDef = new ArrayList<BotDefinition>();
	botDef.add(new AnnotatedTemplatedBehaviourTest());
	ConfigurationUtils.loadBotConfig();
	ConfigurationUtils.setBotDefinitionInstance(botDef);
	
	for(int i=0;i<10;i++) {
		new Thread(new Runnable() {
			String json = "{\"sender\":{\"id\":\"1158621824216736\"},\"recipient\":{\"id\":\"1226565047419159\"},\"timestamp\":1490832021661,\"message\":{\"mid\":\"mid.$cAAUPCFn4ymdhTcignVbHH3rzpKd_\",\"seq\":844819,\"text\":\"Hi!\"}}";
			MessageEnvelope envelope = FbBotMillJsonUtils.fromJson(json, MessageEnvelope.class);
			@Override
			public void run() {
				try {
					IncomingToOutgoingMessageHandler.getInstance().process(envelope);
				}catch(Exception e) {
					e.printStackTrace();
				}
			}
		}).start();
	}
}
 
开发者ID:BotMill,项目名称:fb-botmill,代码行数:26,代码来源:AnnotatedTemplateTest.java

示例14: testEncrypt

import org.jasypt.encryption.pbe.StandardPBEStringEncryptor; //导入依赖的package包/类
@Test
public void testEncrypt()
{
    StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor();
    encryptor.setProvider(new BouncyCastleProvider());
    encryptor.setAlgorithm("PBEWITHSHA256AND256BITAES-CBC-BC");
    encryptor.setPassword("[email protected][email protected]");
    encryptor.setKeyObtentionIterations(1000);

    String clearText = "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890";
    System.out.println("clearText.length="+clearText.length());
    System.out.println("clearText="+clearText);
    String encryptedText = encryptor.encrypt(clearText);
    System.out.println("encryptedText.length="+encryptedText.length());
    System.out.println("encryptedText="+encryptedText);
    assertEquals(encryptedText.length(), 172);
    String decryptedText = encryptor.decrypt(encryptedText);
    assertEquals(decryptedText, clearText);
}
 
开发者ID:alfameCom,项目名称:salasanasiilo,代码行数:20,代码来源:JasyptBCAESEncryptionTest.java

示例15: initEncryption

import org.jasypt.encryption.pbe.StandardPBEStringEncryptor; //导入依赖的package包/类
private void initEncryption() {
	StandardPBEStringEncryptor strongEncryptor = new StandardPBEStringEncryptor();
	StandardPBEBigDecimalEncryptor bigDecimalEncryptor = new StandardPBEBigDecimalEncryptor();
	StandardPBEBigIntegerEncryptor bigIntegerEncryptor = new StandardPBEBigIntegerEncryptor();

	try {
		String encryptionPassword = environment.getProperty("security.password");
		strongEncryptor.setPassword(encryptionPassword);
		bigDecimalEncryptor.setPassword(encryptionPassword);
		bigIntegerEncryptor.setPassword(encryptionPassword);
	} catch (Exception e) {
		e.printStackTrace();
		throw new RuntimeException("TechyTax properties not found!");
	}

	HibernatePBEEncryptorRegistry registry = HibernatePBEEncryptorRegistry.getInstance();
	registry.registerPBEStringEncryptor("strongHibernateStringEncryptor", strongEncryptor);
	registry.registerPBEBigDecimalEncryptor("bigDecimalEncryptor", bigDecimalEncryptor);
	registry.registerPBEBigIntegerEncryptor("integerEncryptor", bigIntegerEncryptor);
}
 
开发者ID:beemsoft,项目名称:techytax-zk,代码行数:21,代码来源:ApplicationContext.java


注:本文中的org.jasypt.encryption.pbe.StandardPBEStringEncryptor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。