com.dell.cpsd.hdp.capability.registry.api.Encryption Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hdp-capability-registry-client Show documentation
Show all versions of hdp-capability-registry-client Show documentation
This repository contains the source code for the capability registry API.
This API exposes the interface through which a consumer or provider interacts with the capability registry.
package com.dell.cpsd.hdp.capability.registry.api;
import java.util.HashMap;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyDescription;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonValue;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
"algorithm",
"publicKeyString"
})
public class Encryption {
/**
* This is the algorithm that needs to be used for generating the Key Factory
* (Required)
*
*/
@JsonProperty("algorithm")
@JsonPropertyDescription("")
private Encryption.Algorithm algorithm;
/**
* This is the ASN.1 encoded public key string
* (Required)
*
*/
@JsonProperty("publicKeyString")
@JsonPropertyDescription("")
private String publicKeyString;
/**
* No args constructor for use in serialization
*
*/
public Encryption() {
}
/**
*
* @param publicKeyString
* @param algorithm
*/
public Encryption(Encryption.Algorithm algorithm, String publicKeyString) {
super();
this.algorithm = algorithm;
this.publicKeyString = publicKeyString;
}
/**
* This is the algorithm that needs to be used for generating the Key Factory
* (Required)
*
* @return
* The algorithm
*/
@JsonProperty("algorithm")
public Encryption.Algorithm getAlgorithm() {
return algorithm;
}
/**
* This is the algorithm that needs to be used for generating the Key Factory
* (Required)
*
* @param algorithm
* The algorithm
*/
@JsonProperty("algorithm")
public void setAlgorithm(Encryption.Algorithm algorithm) {
this.algorithm = algorithm;
}
/**
* This is the ASN.1 encoded public key string
* (Required)
*
* @return
* The publicKeyString
*/
@JsonProperty("publicKeyString")
public String getPublicKeyString() {
return publicKeyString;
}
/**
* This is the ASN.1 encoded public key string
* (Required)
*
* @param publicKeyString
* The publicKeyString
*/
@JsonProperty("publicKeyString")
public void setPublicKeyString(String publicKeyString) {
this.publicKeyString = publicKeyString;
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this);
}
@Override
public int hashCode() {
return new HashCodeBuilder().append(algorithm).append(publicKeyString).toHashCode();
}
@Override
public boolean equals(Object other) {
if (other == this) {
return true;
}
if ((other instanceof Encryption) == false) {
return false;
}
Encryption rhs = ((Encryption) other);
return new EqualsBuilder().append(algorithm, rhs.algorithm).append(publicKeyString, rhs.publicKeyString).isEquals();
}
public enum Algorithm {
RSA("RSA"),
DSA("DSA");
private final String value;
private final static Map CONSTANTS = new HashMap();
static {
for (Encryption.Algorithm c: values()) {
CONSTANTS.put(c.value, c);
}
}
private Algorithm(String value) {
this.value = value;
}
@Override
public String toString() {
return this.value;
}
@JsonValue
public String value() {
return this.value;
}
@JsonCreator
public static Encryption.Algorithm fromValue(String value) {
Encryption.Algorithm constant = CONSTANTS.get(value);
if (constant == null) {
throw new IllegalArgumentException(value);
} else {
return constant;
}
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy