當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。