40 lines
669 B
Plaintext
40 lines
669 B
Plaintext
|
|
package com.nationalelectric.greenH5.identityAuth.util;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* TODO DOCUMENT ME!
|
||
|
|
*
|
||
|
|
* @author <a href="mailto:93785732@qq.com">ZhengDaHong@fzfx</a>
|
||
|
|
* @since 2018/2/1 17:19
|
||
|
|
*/
|
||
|
|
public enum SignatureType {
|
||
|
|
|
||
|
|
MD5("MD5"),
|
||
|
|
|
||
|
|
SHA1("SHA1"),
|
||
|
|
|
||
|
|
SHA256("SHA256");
|
||
|
|
|
||
|
|
|
||
|
|
private String algorithm;
|
||
|
|
|
||
|
|
|
||
|
|
SignatureType(String algorithm) {
|
||
|
|
this.algorithm = algorithm;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
public String getAlgorithm() {
|
||
|
|
return algorithm;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
public static SignatureType of(String algorithm){
|
||
|
|
switch (algorithm){
|
||
|
|
case "MD5": return MD5;
|
||
|
|
case "SHA1": return SHA1;
|
||
|
|
case "SHA256": return SHA256;
|
||
|
|
default: throw new IllegalArgumentException("Unknown algorithm: " + algorithm);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|