package com.google.crypto.tink.proto;
public final class KeyData extends
com.google.protobuf.GeneratedMessageV3 implements
KeyDataOrBuilder {
private static final long serialVersionUID = 0L;
private KeyData(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
super(builder);
}
private KeyData() {
typeUrl_ = "";
value_ = com.google.protobuf.ByteString.EMPTY;
keyMaterialType_ = 0;
}
@java.lang.Override
@SuppressWarnings({"unused"})
protected java.lang.Object newInstance(
UnusedPrivateParameter unused) {
return new KeyData();
}
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private KeyData(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
this();
if (extensionRegistry == null) {
throw new java.lang.NullPointerException();
}
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();
typeUrl_ = s;
break;
}
case 18: {
value_ = input.readBytes();
break;
}
case 24: {
int rawValue = input.readEnum();
keyMaterialType_ = rawValue;
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 com.google.crypto.tink.proto.Tink.internal_static_google_crypto_tink_KeyData_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.google.crypto.tink.proto.Tink.internal_static_google_crypto_tink_KeyData_fieldAccessorTable
.ensureFieldAccessorsInitialized(
com.google.crypto.tink.proto.KeyData.class, com.google.crypto.tink.proto.KeyData.Builder.class);
}
public enum KeyMaterialType
implements com.google.protobuf.ProtocolMessageEnum {
UNKNOWN_KEYMATERIAL(0),
SYMMETRIC(1),
ASYMMETRIC_PRIVATE(2),
ASYMMETRIC_PUBLIC(3),
REMOTE(4),
UNRECOGNIZED(-1),
;
public static final int UNKNOWN_KEYMATERIAL_VALUE = 0;
public static final int SYMMETRIC_VALUE = 1;
public static final int ASYMMETRIC_PRIVATE_VALUE = 2;
public static final int ASYMMETRIC_PUBLIC_VALUE = 3;
public static final int REMOTE_VALUE = 4;
public final int getNumber() {
if (this == UNRECOGNIZED) {
throw new java.lang.IllegalArgumentException(
"Can't get the number of an unknown enum value.");
}
return value;
}
@java.lang.Deprecated
public static KeyMaterialType valueOf(int value) {
return forNumber(value);
}
public static KeyMaterialType forNumber(int value) {
switch (value) {
case 0: return UNKNOWN_KEYMATERIAL;
case 1: return SYMMETRIC;
case 2: return ASYMMETRIC_PRIVATE;
case 3: return ASYMMETRIC_PUBLIC;
case 4: return REMOTE;
default: return null;
}
}
public static com.google.protobuf.Internal.EnumLiteMap<KeyMaterialType>
internalGetValueMap() {
return internalValueMap;
}
private static final com.google.protobuf.Internal.EnumLiteMap<
KeyMaterialType> internalValueMap =
new com.google.protobuf.Internal.EnumLiteMap<KeyMaterialType>() {
public KeyMaterialType findValueByNumber(int number) {
return KeyMaterialType.forNumber(number);
}
};
public final com.google.protobuf.Descriptors.EnumValueDescriptor
getValueDescriptor() {
return getDescriptor().getValues().get(ordinal());
}
public final com.google.protobuf.Descriptors.EnumDescriptor
getDescriptorForType() {
return getDescriptor();
}
public static final com.google.protobuf.Descriptors.EnumDescriptor
getDescriptor() {
return com.google.crypto.tink.proto.KeyData.getDescriptor().getEnumTypes().get(0);
}
private static final KeyMaterialType[] VALUES = values();
public static KeyMaterialType valueOf(
com.google.protobuf.Descriptors.EnumValueDescriptor desc) {
if (desc.getType() != getDescriptor()) {
throw new java.lang.IllegalArgumentException(
"EnumValueDescriptor is not for this type.");
}
if (desc.getIndex() == -1) {
return UNRECOGNIZED;
}
return VALUES[desc.getIndex()];
}
private final int value;
private KeyMaterialType(int value) {
this.value = value;
}
}
public static final int TYPE_URL_FIELD_NUMBER = 1;
private volatile java.lang.Object typeUrl_;
public java.lang.String getTypeUrl() {
java.lang.Object ref = typeUrl_;
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();
typeUrl_ = s;
return s;
}
}
public com.google.protobuf.ByteString
getTypeUrlBytes() {
java.lang.Object ref = typeUrl_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
typeUrl_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
public static final int VALUE_FIELD_NUMBER = 2;
private com.google.protobuf.ByteString value_;
public com.google.protobuf.ByteString getValue() {
return value_;
}
public static final int KEY_MATERIAL_TYPE_FIELD_NUMBER = 3;
private int keyMaterialType_;
public int getKeyMaterialTypeValue() {
return keyMaterialType_;
}
public com.google.crypto.tink.proto.KeyData.KeyMaterialType getKeyMaterialType() {
@SuppressWarnings("deprecation")
com.google.crypto.tink.proto.KeyData.KeyMaterialType result = com.google.crypto.tink.proto.KeyData.KeyMaterialType.valueOf(keyMaterialType_);
return result == null ? com.google.crypto.tink.proto.KeyData.KeyMaterialType.UNRECOGNIZED : result;
}
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 (!getTypeUrlBytes().isEmpty()) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 1, typeUrl_);
}
if (!value_.isEmpty()) {
output.writeBytes(2, value_);
}
if (keyMaterialType_ != com.google.crypto.tink.proto.KeyData.KeyMaterialType.UNKNOWN_KEYMATERIAL.getNumber()) {
output.writeEnum(3, keyMaterialType_);
}
unknownFields.writeTo(output);
}
@java.lang.Override
public int getSerializedSize() {
int size = memoizedSize;
if (size != -1) return size;
size = 0;
if (!getTypeUrlBytes().isEmpty()) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, typeUrl_);
}
if (!value_.isEmpty()) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(2, value_);
}
if (keyMaterialType_ != com.google.crypto.tink.proto.KeyData.KeyMaterialType.UNKNOWN_KEYMATERIAL.getNumber()) {
size += com.google.protobuf.CodedOutputStream
.computeEnumSize(3, keyMaterialType_);
}
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 com.google.crypto.tink.proto.KeyData)) {
return super.equals(obj);
}
com.google.crypto.tink.proto.KeyData other = (com.google.crypto.tink.proto.KeyData) obj;
if (!getTypeUrl()
.equals(other.getTypeUrl())) return false;
if (!getValue()
.equals(other.getValue())) return false;
if (keyMaterialType_ != other.keyMaterialType_) return false;
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) + TYPE_URL_FIELD_NUMBER;
hash = (53 * hash) + getTypeUrl().hashCode();
hash = (37 * hash) + VALUE_FIELD_NUMBER;
hash = (53 * hash) + getValue().hashCode();
hash = (37 * hash) + KEY_MATERIAL_TYPE_FIELD_NUMBER;
hash = (53 * hash) + keyMaterialType_;
hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash;
return hash;
}
public static com.google.crypto.tink.proto.KeyData parseFrom(
java.nio.ByteBuffer data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.google.crypto.tink.proto.KeyData parseFrom(
java.nio.ByteBuffer data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.google.crypto.tink.proto.KeyData parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.google.crypto.tink.proto.KeyData parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.google.crypto.tink.proto.KeyData parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.google.crypto.tink.proto.KeyData parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.google.crypto.tink.proto.KeyData parseFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static com.google.crypto.tink.proto.KeyData 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 com.google.crypto.tink.proto.KeyData parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input);
}
public static com.google.crypto.tink.proto.KeyData 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 com.google.crypto.tink.proto.KeyData parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static com.google.crypto.tink.proto.KeyData 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(com.google.crypto.tink.proto.KeyData 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;
}
public static final class Builder extends
com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
com.google.crypto.tink.proto.KeyDataOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.google.crypto.tink.proto.Tink.internal_static_google_crypto_tink_KeyData_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.google.crypto.tink.proto.Tink.internal_static_google_crypto_tink_KeyData_fieldAccessorTable
.ensureFieldAccessorsInitialized(
com.google.crypto.tink.proto.KeyData.class, com.google.crypto.tink.proto.KeyData.Builder.class);
}
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();
typeUrl_ = "";
value_ = com.google.protobuf.ByteString.EMPTY;
keyMaterialType_ = 0;
return this;
}
@java.lang.Override
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return com.google.crypto.tink.proto.Tink.internal_static_google_crypto_tink_KeyData_descriptor;
}
@java.lang.Override
public com.google.crypto.tink.proto.KeyData getDefaultInstanceForType() {
return com.google.crypto.tink.proto.KeyData.getDefaultInstance();
}
@java.lang.Override
public com.google.crypto.tink.proto.KeyData build() {
com.google.crypto.tink.proto.KeyData result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
@java.lang.Override
public com.google.crypto.tink.proto.KeyData buildPartial() {
com.google.crypto.tink.proto.KeyData result = new com.google.crypto.tink.proto.KeyData(this);
result.typeUrl_ = typeUrl_;
result.value_ = value_;
result.keyMaterialType_ = keyMaterialType_;
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 com.google.crypto.tink.proto.KeyData) {
return mergeFrom((com.google.crypto.tink.proto.KeyData)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(com.google.crypto.tink.proto.KeyData other) {
if (other == com.google.crypto.tink.proto.KeyData.getDefaultInstance()) return this;
if (!other.getTypeUrl().isEmpty()) {
typeUrl_ = other.typeUrl_;
onChanged();
}
if (other.getValue() != com.google.protobuf.ByteString.EMPTY) {
setValue(other.getValue());
}
if (other.keyMaterialType_ != 0) {
setKeyMaterialTypeValue(other.getKeyMaterialTypeValue());
}
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 {
com.google.crypto.tink.proto.KeyData parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (com.google.crypto.tink.proto.KeyData) e.getUnfinishedMessage();
throw e.unwrapIOException();
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private java.lang.Object typeUrl_ = "";
public java.lang.String getTypeUrl() {
java.lang.Object ref = typeUrl_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
typeUrl_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
public com.google.protobuf.ByteString
getTypeUrlBytes() {
java.lang.Object ref = typeUrl_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
typeUrl_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
public Builder setTypeUrl(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
typeUrl_ = value;
onChanged();
return this;
}
public Builder clearTypeUrl() {
typeUrl_ = getDefaultInstance().getTypeUrl();
onChanged();
return this;
}
public Builder setTypeUrlBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
checkByteStringIsUtf8(value);
typeUrl_ = value;
onChanged();
return this;
}
private com.google.protobuf.ByteString value_ = com.google.protobuf.ByteString.EMPTY;
public com.google.protobuf.ByteString getValue() {
return value_;
}
public Builder setValue(com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
value_ = value;
onChanged();
return this;
}
public Builder clearValue() {
value_ = getDefaultInstance().getValue();
onChanged();
return this;
}
private int keyMaterialType_ = 0;
public int getKeyMaterialTypeValue() {
return keyMaterialType_;
}
public Builder setKeyMaterialTypeValue(int value) {
keyMaterialType_ = value;
onChanged();
return this;
}
public com.google.crypto.tink.proto.KeyData.KeyMaterialType getKeyMaterialType() {
@SuppressWarnings("deprecation")
com.google.crypto.tink.proto.KeyData.KeyMaterialType result = com.google.crypto.tink.proto.KeyData.KeyMaterialType.valueOf(keyMaterialType_);
return result == null ? com.google.crypto.tink.proto.KeyData.KeyMaterialType.UNRECOGNIZED : result;
}
public Builder setKeyMaterialType(com.google.crypto.tink.proto.KeyData.KeyMaterialType value) {
if (value == null) {
throw new NullPointerException();
}
keyMaterialType_ = value.getNumber();
onChanged();
return this;
}
public Builder clearKeyMaterialType() {
keyMaterialType_ = 0;
onChanged();
return this;
}
@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);
}
}
private static final com.google.crypto.tink.proto.KeyData DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new com.google.crypto.tink.proto.KeyData();
}
public static com.google.crypto.tink.proto.KeyData getDefaultInstance() {
return DEFAULT_INSTANCE;
}
private static final com.google.protobuf.Parser<KeyData>
PARSER = new com.google.protobuf.AbstractParser<KeyData>() {
@java.lang.Override
public KeyData parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new KeyData(input, extensionRegistry);
}
};
public static com.google.protobuf.Parser<KeyData> parser() {
return PARSER;
}
@java.lang.Override
public com.google.protobuf.Parser<KeyData> getParserForType() {
return PARSER;
}
@java.lang.Override
public com.google.crypto.tink.proto.KeyData getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
}