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


Java BasicTextEncryptor.setPassword方法代码示例

本文整理汇总了Java中org.jasypt.util.text.BasicTextEncryptor.setPassword方法的典型用法代码示例。如果您正苦于以下问题:Java BasicTextEncryptor.setPassword方法的具体用法?Java BasicTextEncryptor.setPassword怎么用?Java BasicTextEncryptor.setPassword使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jasypt.util.text.BasicTextEncryptor的用法示例。


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

示例1: getPassw

import org.jasypt.util.text.BasicTextEncryptor; //导入方法依赖的package包/类
public List<Password> getPassw(String username){
    List<Password> passwords = new ArrayList<>();
    List<Password> encryptedPasswords = dao.getUserPasswords(username);

        BasicTextEncryptor encryptor = new BasicTextEncryptor();
        encryptor.setPassword(PasswordManagerGUI.getSessionPassword());

        for (Password temp : encryptedPasswords) {
            try {
                Password decryptedPassword = new Password();
                decryptedPassword.setUsername(username);
                decryptedPassword.setWebpage(encryptor.decrypt(temp.getWebpage()));
                decryptedPassword.setP_username(encryptor.decrypt(temp.getP_username()));
                decryptedPassword.setP_password(encryptor.decrypt(temp.getP_password()));
                passwords.add(decryptedPassword);

            } catch (Exception x){
                x.printStackTrace();
            }
        }
    //System.out.println(passwords);
       return passwords;
}
 
开发者ID:zoltanvi,项目名称:password-manager,代码行数:24,代码来源:PasswordManagerController.java

示例2: main

import org.jasypt.util.text.BasicTextEncryptor; //导入方法依赖的package包/类
public static void main(String[] args) {
	if (args != null && args.length == 2) {
		if (args[0].equals("-encrypt")) {
			BasicTextEncryptor textEncryptor = new BasicTextEncryptor();
			textEncryptor.setPassword(secret);
			String plainText = textEncryptor.encrypt(args[1]);
			System.out.println("Encrypted Password is :" + plainText);
			return;
		}
	} else if (args != null && args.length > 0) {
		System.out.println(
				"Usage: ./mmagent to run with the configuration \n -encrypt <password> to Encrypt Password for config ");
		return;
	}
	MirrorMakerAgent agent = new MirrorMakerAgent();
	if (agent.checkStartup()) {
		logger.info("mmagent started, loading properties");
		agent.checkAgentProcess();
		agent.readAgentTopic();
	} else {
		System.out.println(
				"ERROR: mmagent startup unsuccessful, please make sure the mmagenthome /etc/mmagent.config is set and mechid have the rights to the topic");
	}
}
 
开发者ID:att,项目名称:dmaap-framework,代码行数:25,代码来源:MirrorMakerAgent.java

示例3: encryptProperty

import org.jasypt.util.text.BasicTextEncryptor; //导入方法依赖的package包/类
public void encryptProperty(String key)
{
    BasicTextEncryptor textEncryptor = new BasicTextEncryptor();
    textEncryptor.setPassword(ENC_PASSWORD);

    final String decryptedValue = getProperty(key);
    if (decryptedValue != null && !decryptedValue.isEmpty())
    {
        try
        {
            final String encryptedValue = textEncryptor.encrypt(decryptedValue);
            setProperty(key, encryptedValue);
        }
        catch (Exception e)
        {
            final String errorMessage = "Error encrypting value for " + key + " property";
            logger.error(errorMessage, e);
            ChatWindow.popup.handleProblem(errorMessage);
            setProperty(key, "");
        }
    }
}
 
开发者ID:GlitchCog,项目名称:ChatGameFontificator,代码行数:23,代码来源:FontificatorProperties.java

示例4: decryptProperty

import org.jasypt.util.text.BasicTextEncryptor; //导入方法依赖的package包/类
public void decryptProperty(String key)
{
    BasicTextEncryptor textEncryptor = new BasicTextEncryptor();
    textEncryptor.setPassword(ENC_PASSWORD);
    final String encryptedValue = getProperty(key);
    if (encryptedValue != null && !encryptedValue.isEmpty())
    {
        try
        {
            final String decryptedValue = textEncryptor.decrypt(encryptedValue);
            setProperty(key, decryptedValue);
        }
        catch (Exception e)
        {
            final String errorMessage = "Error decrypting value for " + key + " property";
            logger.error(errorMessage, e);
            ChatWindow.popup.handleProblem(errorMessage);
            setProperty(key, "");
        }
    }
}
 
开发者ID:GlitchCog,项目名称:ChatGameFontificator,代码行数:22,代码来源:FontificatorProperties.java

示例5: loadProperties

import org.jasypt.util.text.BasicTextEncryptor; //导入方法依赖的package包/类
private void loadProperties() {
	InputStream input = null;
	try {

		input = new FileInputStream(mmagenthome + "/etc/mmagent.config");
		mirrorMakerProperties.load(input);
		Gson g = new Gson();
		if (mirrorMakerProperties.getProperty("mirrormakers") == null) {
			this.mirrorMakers = new ListMirrorMaker();
			ArrayList<MirrorMaker> list = this.mirrorMakers.getListMirrorMaker();
			list = new ArrayList<MirrorMaker>();
			this.mirrorMakers.setListMirrorMaker(list);
		} else {
			this.mirrorMakers = g.fromJson(mirrorMakerProperties.getProperty("mirrormakers"),
					ListMirrorMaker.class);
		}

		this.kafkahome = mirrorMakerProperties.getProperty("kafkahome");
		this.topicURL = mirrorMakerProperties.getProperty("topicURL");
		this.topicname = mirrorMakerProperties.getProperty("topicname");
		this.mechid = mirrorMakerProperties.getProperty("mechid");

		BasicTextEncryptor textEncryptor = new BasicTextEncryptor();
		textEncryptor.setPassword(secret);
		//this.password = textEncryptor.decrypt(mirrorMakerProperties.getProperty("password"));
		this.password = mirrorMakerProperties.getProperty("password");
	} catch (IOException ex) {
		// ex.printStackTrace();
	} finally {
		if (input != null) {
			try {
				input.close();
			} catch (IOException e) {
				// e.printStackTrace();
			}
		}
	}

}
 
开发者ID:att,项目名称:dmaap-framework,代码行数:40,代码来源:MirrorMakerAgent.java

示例6: externalSystemStrategy

import org.jasypt.util.text.BasicTextEncryptor; //导入方法依赖的package包/类
@Override
public ExternalSystemStrategy externalSystemStrategy() {
	System.setProperty("com.microsoft.tfs.jni.native.base-directory", nativePath);

	BasicTextEncryptor encyptor = new BasicTextEncryptor();
	encyptor.setPassword(ENCRYPTOR_DEFAULT_PASS);
	return new TfsSdkStrategy(context.getBean(InternalTicketAssembler.class),
			tfsFieldBuilders(), encyptor);
}
 
开发者ID:reportportal,项目名称:service-tfs,代码行数:10,代码来源:TfsServiceApp.java

示例7: decrypt

import org.jasypt.util.text.BasicTextEncryptor; //导入方法依赖的package包/类
public static String decrypt(final String encryptedVal) {
	if (encryptedVal == null) {
		return null;
	}
	BasicTextEncryptor textEncryptor = new BasicTextEncryptor();
	textEncryptor.setPassword(MY_ENCRIPTED_PASSWORD);
	return textEncryptor.decrypt(encryptedVal);

}
 
开发者ID:SchweizerischeBundesbahnen,项目名称:releasetrain,代码行数:10,代码来源:EncryptorImpl.java

示例8: encrypt

import org.jasypt.util.text.BasicTextEncryptor; //导入方法依赖的package包/类
public static String encrypt(final String valueEnc) {
	if (valueEnc == null) {
		return null;
	}
	BasicTextEncryptor textEncryptor = new BasicTextEncryptor();
	textEncryptor.setPassword(MY_ENCRIPTED_PASSWORD);
	return textEncryptor.encrypt(valueEnc);
}
 
开发者ID:SchweizerischeBundesbahnen,项目名称:releasetrain,代码行数:9,代码来源:EncryptorImpl.java

示例9: main

import org.jasypt.util.text.BasicTextEncryptor; //导入方法依赖的package包/类
public static void main(String[] args) {
  String password = args.length >= 1 ? args[0] : "strong";
  String text = args.length >= 2 ? args[1] : "i am hero";

  PasswordEncryptor passwordEncryptor = new StrongPasswordEncryptor();
  String encryptedPassword = passwordEncryptor.encryptPassword(password);

  BasicTextEncryptor textEncryptor = new BasicTextEncryptor();
  textEncryptor.setPassword(encryptedPassword);
  String myEncryptedText = textEncryptor.encrypt(text);

  System.out.println(myEncryptedText);
}
 
开发者ID:jandy-team,项目名称:jandy,代码行数:14,代码来源:Main.java

示例10: testBasicEncryptionAndDecryption

import org.jasypt.util.text.BasicTextEncryptor; //导入方法依赖的package包/类
@Test
public void testBasicEncryptionAndDecryption() throws IOException {
  String password = UUID.randomUUID().toString();
  String masterPassword = UUID.randomUUID().toString();
  File masterPwdFile = getMasterPwdFile(masterPassword);
  State state = new State();
  state.setProp(ConfigurationKeys.ENCRYPT_KEY_LOC, masterPwdFile.toString());
  BasicTextEncryptor encryptor = new BasicTextEncryptor();
  encryptor.setPassword(masterPassword);
  String encrypted = encryptor.encrypt(password);
  encrypted = "ENC(" + encrypted + ")";
  String decrypted = PasswordManager.getInstance(state).readPassword(encrypted);
  Assert.assertEquals(decrypted, password);
}
 
开发者ID:Hanmourang,项目名称:Gobblin,代码行数:15,代码来源:PasswordManagerTest.java

示例11: init

import org.jasypt.util.text.BasicTextEncryptor; //导入方法依赖的package包/类
/**
 * Initial config for the Crypt Service
 */
public void init(){
	
	logger.info("initial crypt service configuration");
	
	
	//TODO check JCE extensions for StringTextEncryptor
	BasicTextEncryptor bte=new BasicTextEncryptor(); 
	bte.setPassword(this.basePassword);
	this.textEncryptor=bte;
}
 
开发者ID:orange-cloudfoundry,项目名称:elpaaso-core,代码行数:14,代码来源:CryptServiceImpl.java

示例12: textEncryptor

import org.jasypt.util.text.BasicTextEncryptor; //导入方法依赖的package包/类
@Bean
public TextEncryptor textEncryptor() {
    final FactoryBean<String> passwordFactory = new TextEncryptorPasswordFactory();

    final BasicTextEncryptor basicTextEncryptor = new BasicTextEncryptor();

    try {
        basicTextEncryptor.setPassword(passwordFactory.getObject());
    } catch(final Exception e) {
        throw new BeanInitializationException("Failed to initialize TextEncryptor for some reason", e);
    }

    return basicTextEncryptor;
}
 
开发者ID:hpe-idol,项目名称:find,代码行数:15,代码来源:ConfigFileConfiguration.java

示例13: setEncryptedPassphrase

import org.jasypt.util.text.BasicTextEncryptor; //导入方法依赖的package包/类
private void setEncryptedPassphrase(String plainPassphrase, State state) throws IOException {
  String masterPassword = UUID.randomUUID().toString();
  createMasterPwdFile(masterPassword);
  state.setProp(ConfigurationKeys.ENCRYPT_KEY_LOC, this.masterPwdFile.toString());
  state.setProp(ConfigurationKeys.ENCRYPT_USE_STRONG_ENCRYPTOR, false);
  BasicTextEncryptor encryptor = new BasicTextEncryptor();
  encryptor.setPassword(masterPassword);
  String encrypted = encryptor.encrypt(plainPassphrase);
  state.setProp("converter.decrypt.passphrase", "ENC(" + encrypted + ")");
}
 
开发者ID:apache,项目名称:incubator-gobblin,代码行数:11,代码来源:DecryptConverterTest.java

示例14: encryptMessage

import org.jasypt.util.text.BasicTextEncryptor; //导入方法依赖的package包/类
/**
 * Encrypt Message into a Base 64 String Data
 *
 * @param message to be encrypted
 * @return String BASE64 encoded Encrypted String of Message.
 */
public static String encryptMessage(String message) {
    initializeDefaultCryptographyProvider();
    BasicTextEncryptor basicTextEncryptor = new BasicTextEncryptor();
    basicTextEncryptor.setPassword(SALT_PW);
    return basicTextEncryptor.encrypt(message);
}
 
开发者ID:jaschenk,项目名称:jeffaschenk-commons,代码行数:13,代码来源:SecurityServiceProviderUtility.java

示例15: decryptMessage

import org.jasypt.util.text.BasicTextEncryptor; //导入方法依赖的package包/类
/**
 * DeCrypt a BASE64 Encoded Encrypted Message to Plain text.
 *
 * @param encryptedMessage
 * @return String - Decrypted Message String
 */
public static String decryptMessage(String encryptedMessage) {
    initializeDefaultCryptographyProvider();
    BasicTextEncryptor basicTextEncryptor = new BasicTextEncryptor();
    basicTextEncryptor.setPassword(SALT_PW);
    return basicTextEncryptor.decrypt(encryptedMessage);
}
 
开发者ID:jaschenk,项目名称:jeffaschenk-commons,代码行数:13,代码来源:SecurityServiceProviderUtility.java


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