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

com.safelayer.rap.crypto.BaseSignatureAlgorithm Maven / Gradle / Ivy

Go to download

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;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy