⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 eosdefaultpasswordcryptimpl.java

📁 EOS的一个很好的例子.包括页面构件、展现构件
💻 JAVA
字号:
package com.primeton.eos.fbframe.fbrole.crypt.impl;

import com.primeton.eos.fbframe.fbrole.crypt.api.PasswordCrypt;
import com.primeton.tp.common.crypto.EOSDigestTool;

/**
 * @author PengYuanlin
 *
 * 这个类是EOS系统缺省提供的PasswordCrypt接口的实现 。
 * 
 */
public class EOSDefaultPasswordCryptImpl implements PasswordCrypt {

	private EOSDigestTool dt = null;
	/**
	 * 
	 */
	public EOSDefaultPasswordCryptImpl(){
		dt = new EOSDigestTool();
	}

	/* 
	 * 判断password加密之后是否和cryptograph相等 。
	 * 
	 */
	public boolean verify(String password, String cryptograph) {
		
		boolean result = false;
		
		try{
			String s = dt.digest(password);
			if( cryptograph.equalsIgnoreCase(s) ){
				result = true;
			}
		}catch(Exception e){
			e.printStackTrace();
		}
		
		return result;
	}

	/*
	 * 对明文password进行加密 。
	 */
	public String encrypt(String password) {
		
		String result = null;
		try{
			result = dt.digest(password);
		}catch(Exception e){
			e.printStackTrace();
		}
		
		return result;
	}

	/*
	 * 对明文password进行加密 。
	 */
	public String encryptForSave(String password) throws Exception {
		return password;
	}

	/*
	 *
	 */
	public String decrypt(String cryptograph)throws Exception
	{
		throw new Exception("");
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -