com.safelayer.rap.crypto.BaseSignatureAlgorithm Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pki-connector-restapi Show documentation
Show all versions of pki-connector-restapi Show documentation
The PKI Connector RESTAPI is a library that helps developing new PKI Connectors for TrustedX
The newest version!
package com.safelayer.rap.crypto;
public enum BaseSignatureAlgorithm {
RSA("rsa"),
ECDSA("ecdsa");
private final String id;
BaseSignatureAlgorithm(String id) {
this.id = id;
}
public static BaseSignatureAlgorithm unsafeValueOfId(String id) {
for (BaseSignatureAlgorithm baseSignatureAlgorithm : values())
if (baseSignatureAlgorithm.getId().equals(id))
return baseSignatureAlgorithm;
return null;
}
public static BaseSignatureAlgorithm safeValueOfId(String id) throws InvalidAlgorithmException {
BaseSignatureAlgorithm baseSignatureAlgorithm = unsafeValueOfId(id);
if (baseSignatureAlgorithm == null)
throw new InvalidAlgorithmException(id);
return baseSignatureAlgorithm;
}
public String getId() {
return id;
}
}