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


Java CipherTools.isKeyAvailable方法代码示例

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


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

示例1: getAuthentication

import com.rapidminer.tools.cipher.CipherTools; //导入方法依赖的package包/类
@Override
public PasswordAuthentication getAuthentication(URL url) throws PasswordInputCanceledException {
	if (url.getProtocol().equals(protocol)) {
		String username = ParameterService.getParameterValue(protocol + ".proxyUsername");
		String password = ParameterService.getParameterValue(protocol + ".proxyPassword");
		// password is stored encrypted, try to decrypt password
		if (password != null && CipherTools.isKeyAvailable()) {
			try {
				password = CipherTools.decrypt(password);
			} catch (CipherException e) {
				// password is in plaintext
			}
		}
		if (username == null || username.isEmpty() || password == null) {  // empty
			// passwords
			// possibly
			// valid!
			PasswordAuthentication passwordAuthentication = PasswordDialog.getPasswordAuthentication("proxy for "
					+ url.toString(), true, false);
			if (passwordAuthentication == null) {
				return null;
			}
			ParameterService.setParameterValue(protocol + ".proxyUsername", passwordAuthentication.getUserName());
			ParameterService.setParameterValue(protocol + ".proxyPassword",
					new String(passwordAuthentication.getPassword()));
			ParameterService.saveParameters();

			return passwordAuthentication;
		}
		return new PasswordAuthentication(username, password.toCharArray());
	}
	return null;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:34,代码来源:GlobalAuthenticator.java

示例2: encryptPassword

import com.rapidminer.tools.cipher.CipherTools; //导入方法依赖的package包/类
private String encryptPassword(String value) {
	if (CipherTools.isKeyAvailable()) {
		try {
			return CipherTools.encrypt(value);
		} catch (CipherException e) {
			LogService.getRoot().log(Level.SEVERE,
			        "com.rapidminer.parameter.ParameterTypePassword.encrypting_password_error");
			return value;
		}
	} else {
		return value;
	}
}
 
开发者ID:rapidminer,项目名称:rapidminer-studio,代码行数:14,代码来源:ParameterTypePassword.java

示例3: decryptPassword

import com.rapidminer.tools.cipher.CipherTools; //导入方法依赖的package包/类
private String decryptPassword(String value) {
	if (CipherTools.isKeyAvailable()) {
		try {
			return CipherTools.decrypt(value);
		} catch (CipherException e) {
			LogService.getRoot().log(Level.FINE,
			        "com.rapidminer.parameter.ParameterTypePassword.password_looks_like_unencrypted_plain_text");
		}
	}
	return value;
}
 
开发者ID:rapidminer,项目名称:rapidminer-studio,代码行数:12,代码来源:ParameterTypePassword.java

示例4: getAuthentication

import com.rapidminer.tools.cipher.CipherTools; //导入方法依赖的package包/类
public PasswordAuthentication getAuthentication(URL url, String i18n, boolean forceRefresh)
		throws PasswordInputCanceledException {
	if (protocol.equals(SOCKS) || url.getProtocol().equals(protocol)) {
		// password is stored encrypted, try to decrypt password
		if (password != null && CipherTools.isKeyAvailable()) {
			try {
				password = CipherTools.decrypt(password);
			} catch (CipherException e) {
				// password is in plaintext
			}
		}
		if (username == null || username.isEmpty() || password == null) {  // empty
			// passwords
			// possibly
			// valid!

			String proxyType = protocol.toUpperCase();
			String proxyID = I18N.getMessage(I18N.getGUIBundle(), "gui.dialog.auth.proxy.id", proxyType);
			String proxyURL = getProxyAddress().toString().replaceAll("/", "");
			String authMessage = getAuthMessage();

			PasswordAuthentication passwordAuthentication = PasswordDialog.getPasswordAuthentication(proxyID,
					proxyURL, forceRefresh, true, i18n, proxyType, proxyURL, authMessage);
			if (passwordAuthentication == null) {
				return null;
			}

			username = passwordAuthentication.getUserName();
			password = new String(passwordAuthentication.getPassword());

			// Verify Settings
			passwordAuthentication = verify(url, passwordAuthentication);

			return passwordAuthentication;
		}

		return new PasswordAuthentication(username, password.toCharArray());
	}
	return null;
}
 
开发者ID:rapidminer,项目名称:rapidminer-studio,代码行数:41,代码来源:GlobalAuthenticator.java

示例5: encryptPassword

import com.rapidminer.tools.cipher.CipherTools; //导入方法依赖的package包/类
private String encryptPassword(String value) {
	if (CipherTools.isKeyAvailable()) {
		try {
			return CipherTools.encrypt(value);
		} catch (CipherException e) {
			//LogService.getGlobal().logError("Cannot encrypt password, using non-encrypted password!");
			LogService.getRoot().log(Level.SEVERE, "com.rapidminer.parameter.ParameterTypePassword.encrypting_password_error");
			return value;
		}
	} else {
		return value;
	}
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:14,代码来源:ParameterTypePassword.java

示例6: decryptPassword

import com.rapidminer.tools.cipher.CipherTools; //导入方法依赖的package包/类
private String decryptPassword(String value) {
	if (CipherTools.isKeyAvailable()) {
		try {
			return CipherTools.decrypt(value);
		} catch (CipherException e) {
			//LogService.getRoot().warning("Password in XML file looks like unencrypted plain text.");
			LogService.getRoot().log(Level.WARNING, "com.rapidminer.parameter.ParameterTypePassword.password_looks_like_unencrypted_plain_text");
		}
	}
	return value;
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:12,代码来源:ParameterTypePassword.java


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