All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.onetwo.common.encrypt.ClearTextMDEncryptImpl Maven / Gradle / Ivy

There is a newer version: 4.7.2
Show newest version
package org.onetwo.common.encrypt;

import org.onetwo.common.utils.Assert;

public class ClearTextMDEncryptImpl implements MDEncrypt{
	
	private String name = "cleartext";

	public ClearTextMDEncryptImpl(){
	}
	public ClearTextMDEncryptImpl(String name){
		this.name = name;
	}

	public String getLabel() {
		return "{"+name+"}";
	}

	@Override
	public boolean checkEncrypt(String source, String encrypt) {
		Assert.hasText(source);
		String noLabels = MDEncryptUtils.trimLabel(encrypt);
		return source.equalsIgnoreCase(noLabels);
	}

	@Override
	public String encrypt(String source) {
		Assert.hasText(source);
		return getLabel()+source;
	}

	@Override
	public String encryptWithSalt(String source, int length) {
		throw new UnsupportedOperationException();
	}

	@Override
	public String encryptWithSalt(String source) {
		throw new UnsupportedOperationException();
	}
	@Override
	public byte[] encryptBytes(byte[] source, byte[] salt) {
		throw new UnsupportedOperationException();
	}
	@Override
    public boolean checkEncrypt(String source, String saltStr, String encrypt) {
		throw new UnsupportedOperationException();
    }
	@Override
    public String encryptWithSalt(String source, byte[] salt) {
		throw new UnsupportedOperationException();
    }
	@Override
    public String encryptWithSalt(String source, String salt) {
		throw new UnsupportedOperationException();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy