io.opencannabis.schema.crypto.primitives.KeyParameters Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-client Show documentation
Show all versions of java-client Show documentation
Java RPCAPI client for the Bloombox Cloud.
The newest version!
/*
* Copyright 2019, Momentum Ideas Co.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: crypto/primitives/Keys.proto
package io.opencannabis.schema.crypto.primitives;
/**
*
* Specifies parameters used to generate an underlying keypair.
*
*
* Protobuf type {@code opencannabis.crypto.KeyParameters}
*/
public final class KeyParameters extends
com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:opencannabis.crypto.KeyParameters)
KeyParametersOrBuilder {
private static final long serialVersionUID = 0L;
// Use KeyParameters.newBuilder() to construct.
private KeyParameters(com.google.protobuf.GeneratedMessageV3.Builder> builder) {
super(builder);
}
private KeyParameters() {
algorithm_ = "";
format_ = "";
type_ = 0;
disposition_ = 0;
}
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private KeyParameters(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
this();
if (extensionRegistry == null) {
throw new java.lang.NullPointerException();
}
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
case 10: {
java.lang.String s = input.readStringRequireUtf8();
algorithm_ = s;
break;
}
case 18: {
java.lang.String s = input.readStringRequireUtf8();
format_ = s;
break;
}
case 24: {
bits_ = input.readUInt32();
break;
}
case 32: {
int rawValue = input.readEnum();
type_ = rawValue;
break;
}
case 40: {
int rawValue = input.readEnum();
disposition_ = rawValue;
break;
}
case 80: {
int rawValue = input.readEnum();
architectureCase_ = 10;
architecture_ = rawValue;
break;
}
case 90: {
io.opencannabis.schema.crypto.primitives.SymmetricKeyParameters.Builder subBuilder = null;
if (architectureCase_ == 11) {
subBuilder = ((io.opencannabis.schema.crypto.primitives.SymmetricKeyParameters) architecture_).toBuilder();
}
architecture_ =
input.readMessage(io.opencannabis.schema.crypto.primitives.SymmetricKeyParameters.parser(), extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom((io.opencannabis.schema.crypto.primitives.SymmetricKeyParameters) architecture_);
architecture_ = subBuilder.buildPartial();
}
architectureCase_ = 11;
break;
}
default: {
if (!parseUnknownField(
input, unknownFields, extensionRegistry, tag)) {
done = true;
}
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return io.opencannabis.schema.crypto.primitives.Keys.internal_static_opencannabis_crypto_KeyParameters_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return io.opencannabis.schema.crypto.primitives.Keys.internal_static_opencannabis_crypto_KeyParameters_fieldAccessorTable
.ensureFieldAccessorsInitialized(
io.opencannabis.schema.crypto.primitives.KeyParameters.class, io.opencannabis.schema.crypto.primitives.KeyParameters.Builder.class);
}
private int architectureCase_ = 0;
private java.lang.Object architecture_;
public enum ArchitectureCase
implements com.google.protobuf.Internal.EnumLite {
SCHEME(10),
SYMMETRIC(11),
ARCHITECTURE_NOT_SET(0);
private final int value;
private ArchitectureCase(int value) {
this.value = value;
}
/**
* @deprecated Use {@link #forNumber(int)} instead.
*/
@java.lang.Deprecated
public static ArchitectureCase valueOf(int value) {
return forNumber(value);
}
public static ArchitectureCase forNumber(int value) {
switch (value) {
case 10: return SCHEME;
case 11: return SYMMETRIC;
case 0: return ARCHITECTURE_NOT_SET;
default: return null;
}
}
public int getNumber() {
return this.value;
}
};
public ArchitectureCase
getArchitectureCase() {
return ArchitectureCase.forNumber(
architectureCase_);
}
public static final int ALGORITHM_FIELD_NUMBER = 1;
private volatile java.lang.Object algorithm_;
/**
*
* Algorithm in use to generate the key.
*
*
* string algorithm = 1;
*/
public java.lang.String getAlgorithm() {
java.lang.Object ref = algorithm_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
algorithm_ = s;
return s;
}
}
/**
*
* Algorithm in use to generate the key.
*
*
* string algorithm = 1;
*/
public com.google.protobuf.ByteString
getAlgorithmBytes() {
java.lang.Object ref = algorithm_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
algorithm_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
public static final int FORMAT_FIELD_NUMBER = 2;
private volatile java.lang.Object format_;
/**
*
* Format name for the key.
*
*
* string format = 2;
*/
public java.lang.String getFormat() {
java.lang.Object ref = format_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
format_ = s;
return s;
}
}
/**
*
* Format name for the key.
*
*
* string format = 2;
*/
public com.google.protobuf.ByteString
getFormatBytes() {
java.lang.Object ref = format_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
format_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
public static final int BITS_FIELD_NUMBER = 3;
private int bits_;
/**
*
* Key size, in bits, if applicable.
*
*
* uint32 bits = 3;
*/
public int getBits() {
return bits_;
}
public static final int TYPE_FIELD_NUMBER = 4;
private int type_;
/**
*
* Type/architecture of the keys.
*
*
* .opencannabis.crypto.KeyType type = 4;
*/
public int getTypeValue() {
return type_;
}
/**
*
* Type/architecture of the keys.
*
*
* .opencannabis.crypto.KeyType type = 4;
*/
public io.opencannabis.schema.crypto.primitives.KeyType getType() {
@SuppressWarnings("deprecation")
io.opencannabis.schema.crypto.primitives.KeyType result = io.opencannabis.schema.crypto.primitives.KeyType.valueOf(type_);
return result == null ? io.opencannabis.schema.crypto.primitives.KeyType.UNRECOGNIZED : result;
}
public static final int DISPOSITION_FIELD_NUMBER = 5;
private int disposition_;
/**
*
* Disposition of the subject key (i.e. scope).
*
*
* .opencannabis.crypto.KeyDisposition disposition = 5;
*/
public int getDispositionValue() {
return disposition_;
}
/**
*
* Disposition of the subject key (i.e. scope).
*
*
* .opencannabis.crypto.KeyDisposition disposition = 5;
*/
public io.opencannabis.schema.crypto.primitives.KeyDisposition getDisposition() {
@SuppressWarnings("deprecation")
io.opencannabis.schema.crypto.primitives.KeyDisposition result = io.opencannabis.schema.crypto.primitives.KeyDisposition.valueOf(disposition_);
return result == null ? io.opencannabis.schema.crypto.primitives.KeyDisposition.UNRECOGNIZED : result;
}
public static final int SCHEME_FIELD_NUMBER = 10;
/**
*
* Key type/keying scheme.
*
*
* .opencannabis.crypto.KeyingScheme scheme = 10;
*/
public int getSchemeValue() {
if (architectureCase_ == 10) {
return (java.lang.Integer) architecture_;
}
return 0;
}
/**
*
* Key type/keying scheme.
*
*
* .opencannabis.crypto.KeyingScheme scheme = 10;
*/
public io.opencannabis.schema.crypto.primitives.KeyingScheme getScheme() {
if (architectureCase_ == 10) {
@SuppressWarnings("deprecation")
io.opencannabis.schema.crypto.primitives.KeyingScheme result = io.opencannabis.schema.crypto.primitives.KeyingScheme.valueOf(
(java.lang.Integer) architecture_);
return result == null ? io.opencannabis.schema.crypto.primitives.KeyingScheme.UNRECOGNIZED : result;
}
return io.opencannabis.schema.crypto.primitives.KeyingScheme.RSA;
}
public static final int SYMMETRIC_FIELD_NUMBER = 11;
/**
*
* Specifies parameters for symmetric keying.
*
*
* .opencannabis.crypto.SymmetricKeyParameters symmetric = 11;
*/
public boolean hasSymmetric() {
return architectureCase_ == 11;
}
/**
*
* Specifies parameters for symmetric keying.
*
*
* .opencannabis.crypto.SymmetricKeyParameters symmetric = 11;
*/
public io.opencannabis.schema.crypto.primitives.SymmetricKeyParameters getSymmetric() {
if (architectureCase_ == 11) {
return (io.opencannabis.schema.crypto.primitives.SymmetricKeyParameters) architecture_;
}
return io.opencannabis.schema.crypto.primitives.SymmetricKeyParameters.getDefaultInstance();
}
/**
*
* Specifies parameters for symmetric keying.
*
*
* .opencannabis.crypto.SymmetricKeyParameters symmetric = 11;
*/
public io.opencannabis.schema.crypto.primitives.SymmetricKeyParametersOrBuilder getSymmetricOrBuilder() {
if (architectureCase_ == 11) {
return (io.opencannabis.schema.crypto.primitives.SymmetricKeyParameters) architecture_;
}
return io.opencannabis.schema.crypto.primitives.SymmetricKeyParameters.getDefaultInstance();
}
private byte memoizedIsInitialized = -1;
@java.lang.Override
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
memoizedIsInitialized = 1;
return true;
}
@java.lang.Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
if (!getAlgorithmBytes().isEmpty()) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 1, algorithm_);
}
if (!getFormatBytes().isEmpty()) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 2, format_);
}
if (bits_ != 0) {
output.writeUInt32(3, bits_);
}
if (type_ != io.opencannabis.schema.crypto.primitives.KeyType.SYMMETRIC.getNumber()) {
output.writeEnum(4, type_);
}
if (disposition_ != io.opencannabis.schema.crypto.primitives.KeyDisposition.PRIVATE.getNumber()) {
output.writeEnum(5, disposition_);
}
if (architectureCase_ == 10) {
output.writeEnum(10, ((java.lang.Integer) architecture_));
}
if (architectureCase_ == 11) {
output.writeMessage(11, (io.opencannabis.schema.crypto.primitives.SymmetricKeyParameters) architecture_);
}
unknownFields.writeTo(output);
}
@java.lang.Override
public int getSerializedSize() {
int size = memoizedSize;
if (size != -1) return size;
size = 0;
if (!getAlgorithmBytes().isEmpty()) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, algorithm_);
}
if (!getFormatBytes().isEmpty()) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, format_);
}
if (bits_ != 0) {
size += com.google.protobuf.CodedOutputStream
.computeUInt32Size(3, bits_);
}
if (type_ != io.opencannabis.schema.crypto.primitives.KeyType.SYMMETRIC.getNumber()) {
size += com.google.protobuf.CodedOutputStream
.computeEnumSize(4, type_);
}
if (disposition_ != io.opencannabis.schema.crypto.primitives.KeyDisposition.PRIVATE.getNumber()) {
size += com.google.protobuf.CodedOutputStream
.computeEnumSize(5, disposition_);
}
if (architectureCase_ == 10) {
size += com.google.protobuf.CodedOutputStream
.computeEnumSize(10, ((java.lang.Integer) architecture_));
}
if (architectureCase_ == 11) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(11, (io.opencannabis.schema.crypto.primitives.SymmetricKeyParameters) architecture_);
}
size += unknownFields.getSerializedSize();
memoizedSize = size;
return size;
}
@java.lang.Override
public boolean equals(final java.lang.Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof io.opencannabis.schema.crypto.primitives.KeyParameters)) {
return super.equals(obj);
}
io.opencannabis.schema.crypto.primitives.KeyParameters other = (io.opencannabis.schema.crypto.primitives.KeyParameters) obj;
if (!getAlgorithm()
.equals(other.getAlgorithm())) return false;
if (!getFormat()
.equals(other.getFormat())) return false;
if (getBits()
!= other.getBits()) return false;
if (type_ != other.type_) return false;
if (disposition_ != other.disposition_) return false;
if (!getArchitectureCase().equals(other.getArchitectureCase())) return false;
switch (architectureCase_) {
case 10:
if (getSchemeValue()
!= other.getSchemeValue()) return false;
break;
case 11:
if (!getSymmetric()
.equals(other.getSymmetric())) return false;
break;
case 0:
default:
}
if (!unknownFields.equals(other.unknownFields)) return false;
return true;
}
@java.lang.Override
public int hashCode() {
if (memoizedHashCode != 0) {
return memoizedHashCode;
}
int hash = 41;
hash = (19 * hash) + getDescriptor().hashCode();
hash = (37 * hash) + ALGORITHM_FIELD_NUMBER;
hash = (53 * hash) + getAlgorithm().hashCode();
hash = (37 * hash) + FORMAT_FIELD_NUMBER;
hash = (53 * hash) + getFormat().hashCode();
hash = (37 * hash) + BITS_FIELD_NUMBER;
hash = (53 * hash) + getBits();
hash = (37 * hash) + TYPE_FIELD_NUMBER;
hash = (53 * hash) + type_;
hash = (37 * hash) + DISPOSITION_FIELD_NUMBER;
hash = (53 * hash) + disposition_;
switch (architectureCase_) {
case 10:
hash = (37 * hash) + SCHEME_FIELD_NUMBER;
hash = (53 * hash) + getSchemeValue();
break;
case 11:
hash = (37 * hash) + SYMMETRIC_FIELD_NUMBER;
hash = (53 * hash) + getSymmetric().hashCode();
break;
case 0:
default:
}
hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash;
return hash;
}
public static io.opencannabis.schema.crypto.primitives.KeyParameters parseFrom(
java.nio.ByteBuffer data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static io.opencannabis.schema.crypto.primitives.KeyParameters parseFrom(
java.nio.ByteBuffer data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static io.opencannabis.schema.crypto.primitives.KeyParameters parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static io.opencannabis.schema.crypto.primitives.KeyParameters parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static io.opencannabis.schema.crypto.primitives.KeyParameters parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static io.opencannabis.schema.crypto.primitives.KeyParameters parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static io.opencannabis.schema.crypto.primitives.KeyParameters parseFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static io.opencannabis.schema.crypto.primitives.KeyParameters parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
public static io.opencannabis.schema.crypto.primitives.KeyParameters parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input);
}
public static io.opencannabis.schema.crypto.primitives.KeyParameters parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input, extensionRegistry);
}
public static io.opencannabis.schema.crypto.primitives.KeyParameters parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static io.opencannabis.schema.crypto.primitives.KeyParameters parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
@java.lang.Override
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder() {
return DEFAULT_INSTANCE.toBuilder();
}
public static Builder newBuilder(io.opencannabis.schema.crypto.primitives.KeyParameters prototype) {
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
}
@java.lang.Override
public Builder toBuilder() {
return this == DEFAULT_INSTANCE
? new Builder() : new Builder().mergeFrom(this);
}
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
*
* Specifies parameters used to generate an underlying keypair.
*
*
* Protobuf type {@code opencannabis.crypto.KeyParameters}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessageV3.Builder implements
// @@protoc_insertion_point(builder_implements:opencannabis.crypto.KeyParameters)
io.opencannabis.schema.crypto.primitives.KeyParametersOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return io.opencannabis.schema.crypto.primitives.Keys.internal_static_opencannabis_crypto_KeyParameters_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return io.opencannabis.schema.crypto.primitives.Keys.internal_static_opencannabis_crypto_KeyParameters_fieldAccessorTable
.ensureFieldAccessorsInitialized(
io.opencannabis.schema.crypto.primitives.KeyParameters.class, io.opencannabis.schema.crypto.primitives.KeyParameters.Builder.class);
}
// Construct using io.opencannabis.schema.crypto.primitives.KeyParameters.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessageV3
.alwaysUseFieldBuilders) {
}
}
@java.lang.Override
public Builder clear() {
super.clear();
algorithm_ = "";
format_ = "";
bits_ = 0;
type_ = 0;
disposition_ = 0;
architectureCase_ = 0;
architecture_ = null;
return this;
}
@java.lang.Override
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return io.opencannabis.schema.crypto.primitives.Keys.internal_static_opencannabis_crypto_KeyParameters_descriptor;
}
@java.lang.Override
public io.opencannabis.schema.crypto.primitives.KeyParameters getDefaultInstanceForType() {
return io.opencannabis.schema.crypto.primitives.KeyParameters.getDefaultInstance();
}
@java.lang.Override
public io.opencannabis.schema.crypto.primitives.KeyParameters build() {
io.opencannabis.schema.crypto.primitives.KeyParameters result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
@java.lang.Override
public io.opencannabis.schema.crypto.primitives.KeyParameters buildPartial() {
io.opencannabis.schema.crypto.primitives.KeyParameters result = new io.opencannabis.schema.crypto.primitives.KeyParameters(this);
result.algorithm_ = algorithm_;
result.format_ = format_;
result.bits_ = bits_;
result.type_ = type_;
result.disposition_ = disposition_;
if (architectureCase_ == 10) {
result.architecture_ = architecture_;
}
if (architectureCase_ == 11) {
if (symmetricBuilder_ == null) {
result.architecture_ = architecture_;
} else {
result.architecture_ = symmetricBuilder_.build();
}
}
result.architectureCase_ = architectureCase_;
onBuilt();
return result;
}
@java.lang.Override
public Builder clone() {
return super.clone();
}
@java.lang.Override
public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return super.setField(field, value);
}
@java.lang.Override
public Builder clearField(
com.google.protobuf.Descriptors.FieldDescriptor field) {
return super.clearField(field);
}
@java.lang.Override
public Builder clearOneof(
com.google.protobuf.Descriptors.OneofDescriptor oneof) {
return super.clearOneof(oneof);
}
@java.lang.Override
public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
int index, java.lang.Object value) {
return super.setRepeatedField(field, index, value);
}
@java.lang.Override
public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return super.addRepeatedField(field, value);
}
@java.lang.Override
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof io.opencannabis.schema.crypto.primitives.KeyParameters) {
return mergeFrom((io.opencannabis.schema.crypto.primitives.KeyParameters)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(io.opencannabis.schema.crypto.primitives.KeyParameters other) {
if (other == io.opencannabis.schema.crypto.primitives.KeyParameters.getDefaultInstance()) return this;
if (!other.getAlgorithm().isEmpty()) {
algorithm_ = other.algorithm_;
onChanged();
}
if (!other.getFormat().isEmpty()) {
format_ = other.format_;
onChanged();
}
if (other.getBits() != 0) {
setBits(other.getBits());
}
if (other.type_ != 0) {
setTypeValue(other.getTypeValue());
}
if (other.disposition_ != 0) {
setDispositionValue(other.getDispositionValue());
}
switch (other.getArchitectureCase()) {
case SCHEME: {
setSchemeValue(other.getSchemeValue());
break;
}
case SYMMETRIC: {
mergeSymmetric(other.getSymmetric());
break;
}
case ARCHITECTURE_NOT_SET: {
break;
}
}
this.mergeUnknownFields(other.unknownFields);
onChanged();
return this;
}
@java.lang.Override
public final boolean isInitialized() {
return true;
}
@java.lang.Override
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
io.opencannabis.schema.crypto.primitives.KeyParameters parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (io.opencannabis.schema.crypto.primitives.KeyParameters) e.getUnfinishedMessage();
throw e.unwrapIOException();
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int architectureCase_ = 0;
private java.lang.Object architecture_;
public ArchitectureCase
getArchitectureCase() {
return ArchitectureCase.forNumber(
architectureCase_);
}
public Builder clearArchitecture() {
architectureCase_ = 0;
architecture_ = null;
onChanged();
return this;
}
private java.lang.Object algorithm_ = "";
/**
*
* Algorithm in use to generate the key.
*
*
* string algorithm = 1;
*/
public java.lang.String getAlgorithm() {
java.lang.Object ref = algorithm_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
algorithm_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
*
* Algorithm in use to generate the key.
*
*
* string algorithm = 1;
*/
public com.google.protobuf.ByteString
getAlgorithmBytes() {
java.lang.Object ref = algorithm_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
algorithm_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
*
* Algorithm in use to generate the key.
*
*
* string algorithm = 1;
*/
public Builder setAlgorithm(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
algorithm_ = value;
onChanged();
return this;
}
/**
*
* Algorithm in use to generate the key.
*
*
* string algorithm = 1;
*/
public Builder clearAlgorithm() {
algorithm_ = getDefaultInstance().getAlgorithm();
onChanged();
return this;
}
/**
*
* Algorithm in use to generate the key.
*
*
* string algorithm = 1;
*/
public Builder setAlgorithmBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
checkByteStringIsUtf8(value);
algorithm_ = value;
onChanged();
return this;
}
private java.lang.Object format_ = "";
/**
*
* Format name for the key.
*
*
* string format = 2;
*/
public java.lang.String getFormat() {
java.lang.Object ref = format_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
format_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
*
* Format name for the key.
*
*
* string format = 2;
*/
public com.google.protobuf.ByteString
getFormatBytes() {
java.lang.Object ref = format_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
format_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
*
* Format name for the key.
*
*
* string format = 2;
*/
public Builder setFormat(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
format_ = value;
onChanged();
return this;
}
/**
*
* Format name for the key.
*
*
* string format = 2;
*/
public Builder clearFormat() {
format_ = getDefaultInstance().getFormat();
onChanged();
return this;
}
/**
*
* Format name for the key.
*
*
* string format = 2;
*/
public Builder setFormatBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
checkByteStringIsUtf8(value);
format_ = value;
onChanged();
return this;
}
private int bits_ ;
/**
*
* Key size, in bits, if applicable.
*
*
* uint32 bits = 3;
*/
public int getBits() {
return bits_;
}
/**
*
* Key size, in bits, if applicable.
*
*
* uint32 bits = 3;
*/
public Builder setBits(int value) {
bits_ = value;
onChanged();
return this;
}
/**
*
* Key size, in bits, if applicable.
*
*
* uint32 bits = 3;
*/
public Builder clearBits() {
bits_ = 0;
onChanged();
return this;
}
private int type_ = 0;
/**
*
* Type/architecture of the keys.
*
*
* .opencannabis.crypto.KeyType type = 4;
*/
public int getTypeValue() {
return type_;
}
/**
*
* Type/architecture of the keys.
*
*
* .opencannabis.crypto.KeyType type = 4;
*/
public Builder setTypeValue(int value) {
type_ = value;
onChanged();
return this;
}
/**
*
* Type/architecture of the keys.
*
*
* .opencannabis.crypto.KeyType type = 4;
*/
public io.opencannabis.schema.crypto.primitives.KeyType getType() {
@SuppressWarnings("deprecation")
io.opencannabis.schema.crypto.primitives.KeyType result = io.opencannabis.schema.crypto.primitives.KeyType.valueOf(type_);
return result == null ? io.opencannabis.schema.crypto.primitives.KeyType.UNRECOGNIZED : result;
}
/**
*
* Type/architecture of the keys.
*
*
* .opencannabis.crypto.KeyType type = 4;
*/
public Builder setType(io.opencannabis.schema.crypto.primitives.KeyType value) {
if (value == null) {
throw new NullPointerException();
}
type_ = value.getNumber();
onChanged();
return this;
}
/**
*
* Type/architecture of the keys.
*
*
* .opencannabis.crypto.KeyType type = 4;
*/
public Builder clearType() {
type_ = 0;
onChanged();
return this;
}
private int disposition_ = 0;
/**
*
* Disposition of the subject key (i.e. scope).
*
*
* .opencannabis.crypto.KeyDisposition disposition = 5;
*/
public int getDispositionValue() {
return disposition_;
}
/**
*
* Disposition of the subject key (i.e. scope).
*
*
* .opencannabis.crypto.KeyDisposition disposition = 5;
*/
public Builder setDispositionValue(int value) {
disposition_ = value;
onChanged();
return this;
}
/**
*
* Disposition of the subject key (i.e. scope).
*
*
* .opencannabis.crypto.KeyDisposition disposition = 5;
*/
public io.opencannabis.schema.crypto.primitives.KeyDisposition getDisposition() {
@SuppressWarnings("deprecation")
io.opencannabis.schema.crypto.primitives.KeyDisposition result = io.opencannabis.schema.crypto.primitives.KeyDisposition.valueOf(disposition_);
return result == null ? io.opencannabis.schema.crypto.primitives.KeyDisposition.UNRECOGNIZED : result;
}
/**
*
* Disposition of the subject key (i.e. scope).
*
*
* .opencannabis.crypto.KeyDisposition disposition = 5;
*/
public Builder setDisposition(io.opencannabis.schema.crypto.primitives.KeyDisposition value) {
if (value == null) {
throw new NullPointerException();
}
disposition_ = value.getNumber();
onChanged();
return this;
}
/**
*
* Disposition of the subject key (i.e. scope).
*
*
* .opencannabis.crypto.KeyDisposition disposition = 5;
*/
public Builder clearDisposition() {
disposition_ = 0;
onChanged();
return this;
}
/**
*
* Key type/keying scheme.
*
*
* .opencannabis.crypto.KeyingScheme scheme = 10;
*/
public int getSchemeValue() {
if (architectureCase_ == 10) {
return ((java.lang.Integer) architecture_).intValue();
}
return 0;
}
/**
*
* Key type/keying scheme.
*
*
* .opencannabis.crypto.KeyingScheme scheme = 10;
*/
public Builder setSchemeValue(int value) {
architectureCase_ = 10;
architecture_ = value;
onChanged();
return this;
}
/**
*
* Key type/keying scheme.
*
*
* .opencannabis.crypto.KeyingScheme scheme = 10;
*/
public io.opencannabis.schema.crypto.primitives.KeyingScheme getScheme() {
if (architectureCase_ == 10) {
@SuppressWarnings("deprecation")
io.opencannabis.schema.crypto.primitives.KeyingScheme result = io.opencannabis.schema.crypto.primitives.KeyingScheme.valueOf(
(java.lang.Integer) architecture_);
return result == null ? io.opencannabis.schema.crypto.primitives.KeyingScheme.UNRECOGNIZED : result;
}
return io.opencannabis.schema.crypto.primitives.KeyingScheme.RSA;
}
/**
*
* Key type/keying scheme.
*
*
* .opencannabis.crypto.KeyingScheme scheme = 10;
*/
public Builder setScheme(io.opencannabis.schema.crypto.primitives.KeyingScheme value) {
if (value == null) {
throw new NullPointerException();
}
architectureCase_ = 10;
architecture_ = value.getNumber();
onChanged();
return this;
}
/**
*
* Key type/keying scheme.
*
*
* .opencannabis.crypto.KeyingScheme scheme = 10;
*/
public Builder clearScheme() {
if (architectureCase_ == 10) {
architectureCase_ = 0;
architecture_ = null;
onChanged();
}
return this;
}
private com.google.protobuf.SingleFieldBuilderV3<
io.opencannabis.schema.crypto.primitives.SymmetricKeyParameters, io.opencannabis.schema.crypto.primitives.SymmetricKeyParameters.Builder, io.opencannabis.schema.crypto.primitives.SymmetricKeyParametersOrBuilder> symmetricBuilder_;
/**
*
* Specifies parameters for symmetric keying.
*
*
* .opencannabis.crypto.SymmetricKeyParameters symmetric = 11;
*/
public boolean hasSymmetric() {
return architectureCase_ == 11;
}
/**
*
* Specifies parameters for symmetric keying.
*
*
* .opencannabis.crypto.SymmetricKeyParameters symmetric = 11;
*/
public io.opencannabis.schema.crypto.primitives.SymmetricKeyParameters getSymmetric() {
if (symmetricBuilder_ == null) {
if (architectureCase_ == 11) {
return (io.opencannabis.schema.crypto.primitives.SymmetricKeyParameters) architecture_;
}
return io.opencannabis.schema.crypto.primitives.SymmetricKeyParameters.getDefaultInstance();
} else {
if (architectureCase_ == 11) {
return symmetricBuilder_.getMessage();
}
return io.opencannabis.schema.crypto.primitives.SymmetricKeyParameters.getDefaultInstance();
}
}
/**
*
* Specifies parameters for symmetric keying.
*
*
* .opencannabis.crypto.SymmetricKeyParameters symmetric = 11;
*/
public Builder setSymmetric(io.opencannabis.schema.crypto.primitives.SymmetricKeyParameters value) {
if (symmetricBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
architecture_ = value;
onChanged();
} else {
symmetricBuilder_.setMessage(value);
}
architectureCase_ = 11;
return this;
}
/**
*
* Specifies parameters for symmetric keying.
*
*
* .opencannabis.crypto.SymmetricKeyParameters symmetric = 11;
*/
public Builder setSymmetric(
io.opencannabis.schema.crypto.primitives.SymmetricKeyParameters.Builder builderForValue) {
if (symmetricBuilder_ == null) {
architecture_ = builderForValue.build();
onChanged();
} else {
symmetricBuilder_.setMessage(builderForValue.build());
}
architectureCase_ = 11;
return this;
}
/**
*
* Specifies parameters for symmetric keying.
*
*
* .opencannabis.crypto.SymmetricKeyParameters symmetric = 11;
*/
public Builder mergeSymmetric(io.opencannabis.schema.crypto.primitives.SymmetricKeyParameters value) {
if (symmetricBuilder_ == null) {
if (architectureCase_ == 11 &&
architecture_ != io.opencannabis.schema.crypto.primitives.SymmetricKeyParameters.getDefaultInstance()) {
architecture_ = io.opencannabis.schema.crypto.primitives.SymmetricKeyParameters.newBuilder((io.opencannabis.schema.crypto.primitives.SymmetricKeyParameters) architecture_)
.mergeFrom(value).buildPartial();
} else {
architecture_ = value;
}
onChanged();
} else {
if (architectureCase_ == 11) {
symmetricBuilder_.mergeFrom(value);
}
symmetricBuilder_.setMessage(value);
}
architectureCase_ = 11;
return this;
}
/**
*
* Specifies parameters for symmetric keying.
*
*
* .opencannabis.crypto.SymmetricKeyParameters symmetric = 11;
*/
public Builder clearSymmetric() {
if (symmetricBuilder_ == null) {
if (architectureCase_ == 11) {
architectureCase_ = 0;
architecture_ = null;
onChanged();
}
} else {
if (architectureCase_ == 11) {
architectureCase_ = 0;
architecture_ = null;
}
symmetricBuilder_.clear();
}
return this;
}
/**
*
* Specifies parameters for symmetric keying.
*
*
* .opencannabis.crypto.SymmetricKeyParameters symmetric = 11;
*/
public io.opencannabis.schema.crypto.primitives.SymmetricKeyParameters.Builder getSymmetricBuilder() {
return getSymmetricFieldBuilder().getBuilder();
}
/**
*
* Specifies parameters for symmetric keying.
*
*
* .opencannabis.crypto.SymmetricKeyParameters symmetric = 11;
*/
public io.opencannabis.schema.crypto.primitives.SymmetricKeyParametersOrBuilder getSymmetricOrBuilder() {
if ((architectureCase_ == 11) && (symmetricBuilder_ != null)) {
return symmetricBuilder_.getMessageOrBuilder();
} else {
if (architectureCase_ == 11) {
return (io.opencannabis.schema.crypto.primitives.SymmetricKeyParameters) architecture_;
}
return io.opencannabis.schema.crypto.primitives.SymmetricKeyParameters.getDefaultInstance();
}
}
/**
*
* Specifies parameters for symmetric keying.
*
*
* .opencannabis.crypto.SymmetricKeyParameters symmetric = 11;
*/
private com.google.protobuf.SingleFieldBuilderV3<
io.opencannabis.schema.crypto.primitives.SymmetricKeyParameters, io.opencannabis.schema.crypto.primitives.SymmetricKeyParameters.Builder, io.opencannabis.schema.crypto.primitives.SymmetricKeyParametersOrBuilder>
getSymmetricFieldBuilder() {
if (symmetricBuilder_ == null) {
if (!(architectureCase_ == 11)) {
architecture_ = io.opencannabis.schema.crypto.primitives.SymmetricKeyParameters.getDefaultInstance();
}
symmetricBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
io.opencannabis.schema.crypto.primitives.SymmetricKeyParameters, io.opencannabis.schema.crypto.primitives.SymmetricKeyParameters.Builder, io.opencannabis.schema.crypto.primitives.SymmetricKeyParametersOrBuilder>(
(io.opencannabis.schema.crypto.primitives.SymmetricKeyParameters) architecture_,
getParentForChildren(),
isClean());
architecture_ = null;
}
architectureCase_ = 11;
onChanged();;
return symmetricBuilder_;
}
@java.lang.Override
public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.setUnknownFields(unknownFields);
}
@java.lang.Override
public final Builder mergeUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.mergeUnknownFields(unknownFields);
}
// @@protoc_insertion_point(builder_scope:opencannabis.crypto.KeyParameters)
}
// @@protoc_insertion_point(class_scope:opencannabis.crypto.KeyParameters)
private static final io.opencannabis.schema.crypto.primitives.KeyParameters DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new io.opencannabis.schema.crypto.primitives.KeyParameters();
}
public static io.opencannabis.schema.crypto.primitives.KeyParameters getDefaultInstance() {
return DEFAULT_INSTANCE;
}
private static final com.google.protobuf.Parser
PARSER = new com.google.protobuf.AbstractParser() {
@java.lang.Override
public KeyParameters parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new KeyParameters(input, extensionRegistry);
}
};
public static com.google.protobuf.Parser parser() {
return PARSER;
}
@java.lang.Override
public com.google.protobuf.Parser getParserForType() {
return PARSER;
}
@java.lang.Override
public io.opencannabis.schema.crypto.primitives.KeyParameters getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy