com.google.crypto.tink.proto.KeyTemplate Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of tink Show documentation
Show all versions of tink Show documentation
Tink is a small cryptographic library that provides a safe, simple, agile and fast way to accomplish some common cryptographic tasks.
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: proto/tink.proto
package com.google.crypto.tink.proto;
/**
* Protobuf type {@code google.crypto.tink.KeyTemplate}
*/
public final class KeyTemplate extends
com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:google.crypto.tink.KeyTemplate)
KeyTemplateOrBuilder {
private static final long serialVersionUID = 0L;
// Use KeyTemplate.newBuilder() to construct.
private KeyTemplate(com.google.protobuf.GeneratedMessageV3.Builder builder) {
super(builder);
}
private KeyTemplate() {
typeUrl_ = "";
value_ = com.google.protobuf.ByteString.EMPTY;
outputPrefixType_ = 0;
}
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private KeyTemplate(
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();
typeUrl_ = s;
break;
}
case 18: {
value_ = input.readBytes();
break;
}
case 24: {
int rawValue = input.readEnum();
outputPrefixType_ = rawValue;
break;
}
default: {
if (!parseUnknownFieldProto3(
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_KeyTemplate_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.google.crypto.tink.proto.Tink.internal_static_google_crypto_tink_KeyTemplate_fieldAccessorTable
.ensureFieldAccessorsInitialized(
com.google.crypto.tink.proto.KeyTemplate.class, com.google.crypto.tink.proto.KeyTemplate.Builder.class);
}
public static final int TYPE_URL_FIELD_NUMBER = 1;
private volatile java.lang.Object typeUrl_;
/**
*
* Required.
*
*
* string type_url = 1;
*/
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;
}
}
/**
*
* Required.
*
*
* string type_url = 1;
*/
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_;
/**
*
* Optional.
* If missing, it means the key type doesn't require a *KeyFormat proto.
*
*
* bytes value = 2;
*/
public com.google.protobuf.ByteString getValue() {
return value_;
}
public static final int OUTPUT_PREFIX_TYPE_FIELD_NUMBER = 3;
private int outputPrefixType_;
/**
*
* Optional.
* If missing, uses OutputPrefixType.TINK.
*
*
* .google.crypto.tink.OutputPrefixType output_prefix_type = 3;
*/
public int getOutputPrefixTypeValue() {
return outputPrefixType_;
}
/**
*
* Optional.
* If missing, uses OutputPrefixType.TINK.
*
*
* .google.crypto.tink.OutputPrefixType output_prefix_type = 3;
*/
public com.google.crypto.tink.proto.OutputPrefixType getOutputPrefixType() {
@SuppressWarnings("deprecation")
com.google.crypto.tink.proto.OutputPrefixType result = com.google.crypto.tink.proto.OutputPrefixType.valueOf(outputPrefixType_);
return result == null ? com.google.crypto.tink.proto.OutputPrefixType.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 (outputPrefixType_ != com.google.crypto.tink.proto.OutputPrefixType.UNKNOWN_PREFIX.getNumber()) {
output.writeEnum(3, outputPrefixType_);
}
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 (outputPrefixType_ != com.google.crypto.tink.proto.OutputPrefixType.UNKNOWN_PREFIX.getNumber()) {
size += com.google.protobuf.CodedOutputStream
.computeEnumSize(3, outputPrefixType_);
}
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.KeyTemplate)) {
return super.equals(obj);
}
com.google.crypto.tink.proto.KeyTemplate other = (com.google.crypto.tink.proto.KeyTemplate) obj;
boolean result = true;
result = result && getTypeUrl()
.equals(other.getTypeUrl());
result = result && getValue()
.equals(other.getValue());
result = result && outputPrefixType_ == other.outputPrefixType_;
result = result && unknownFields.equals(other.unknownFields);
return result;
}
@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) + OUTPUT_PREFIX_TYPE_FIELD_NUMBER;
hash = (53 * hash) + outputPrefixType_;
hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash;
return hash;
}
public static com.google.crypto.tink.proto.KeyTemplate parseFrom(
java.nio.ByteBuffer data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.google.crypto.tink.proto.KeyTemplate 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.KeyTemplate parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.google.crypto.tink.proto.KeyTemplate 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.KeyTemplate parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.google.crypto.tink.proto.KeyTemplate 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.KeyTemplate parseFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static com.google.crypto.tink.proto.KeyTemplate 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.KeyTemplate parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input);
}
public static com.google.crypto.tink.proto.KeyTemplate 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.KeyTemplate 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.KeyTemplate 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.KeyTemplate 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;
}
/**
* Protobuf type {@code google.crypto.tink.KeyTemplate}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessageV3.Builder implements
// @@protoc_insertion_point(builder_implements:google.crypto.tink.KeyTemplate)
com.google.crypto.tink.proto.KeyTemplateOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.google.crypto.tink.proto.Tink.internal_static_google_crypto_tink_KeyTemplate_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.google.crypto.tink.proto.Tink.internal_static_google_crypto_tink_KeyTemplate_fieldAccessorTable
.ensureFieldAccessorsInitialized(
com.google.crypto.tink.proto.KeyTemplate.class, com.google.crypto.tink.proto.KeyTemplate.Builder.class);
}
// Construct using com.google.crypto.tink.proto.KeyTemplate.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();
typeUrl_ = "";
value_ = com.google.protobuf.ByteString.EMPTY;
outputPrefixType_ = 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_KeyTemplate_descriptor;
}
@java.lang.Override
public com.google.crypto.tink.proto.KeyTemplate getDefaultInstanceForType() {
return com.google.crypto.tink.proto.KeyTemplate.getDefaultInstance();
}
@java.lang.Override
public com.google.crypto.tink.proto.KeyTemplate build() {
com.google.crypto.tink.proto.KeyTemplate result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
@java.lang.Override
public com.google.crypto.tink.proto.KeyTemplate buildPartial() {
com.google.crypto.tink.proto.KeyTemplate result = new com.google.crypto.tink.proto.KeyTemplate(this);
result.typeUrl_ = typeUrl_;
result.value_ = value_;
result.outputPrefixType_ = outputPrefixType_;
onBuilt();
return result;
}
@java.lang.Override
public Builder clone() {
return (Builder) super.clone();
}
@java.lang.Override
public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return (Builder) super.setField(field, value);
}
@java.lang.Override
public Builder clearField(
com.google.protobuf.Descriptors.FieldDescriptor field) {
return (Builder) super.clearField(field);
}
@java.lang.Override
public Builder clearOneof(
com.google.protobuf.Descriptors.OneofDescriptor oneof) {
return (Builder) super.clearOneof(oneof);
}
@java.lang.Override
public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
int index, java.lang.Object value) {
return (Builder) super.setRepeatedField(field, index, value);
}
@java.lang.Override
public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return (Builder) super.addRepeatedField(field, value);
}
@java.lang.Override
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof com.google.crypto.tink.proto.KeyTemplate) {
return mergeFrom((com.google.crypto.tink.proto.KeyTemplate)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(com.google.crypto.tink.proto.KeyTemplate other) {
if (other == com.google.crypto.tink.proto.KeyTemplate.getDefaultInstance()) return this;
if (!other.getTypeUrl().isEmpty()) {
typeUrl_ = other.typeUrl_;
onChanged();
}
if (other.getValue() != com.google.protobuf.ByteString.EMPTY) {
setValue(other.getValue());
}
if (other.outputPrefixType_ != 0) {
setOutputPrefixTypeValue(other.getOutputPrefixTypeValue());
}
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.KeyTemplate parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (com.google.crypto.tink.proto.KeyTemplate) e.getUnfinishedMessage();
throw e.unwrapIOException();
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private java.lang.Object typeUrl_ = "";
/**
*
* Required.
*
*
* string type_url = 1;
*/
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;
}
}
/**
*
* Required.
*
*
* string type_url = 1;
*/
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;
}
}
/**
*
* Required.
*
*
* string type_url = 1;
*/
public Builder setTypeUrl(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
typeUrl_ = value;
onChanged();
return this;
}
/**
*
* Required.
*
*
* string type_url = 1;
*/
public Builder clearTypeUrl() {
typeUrl_ = getDefaultInstance().getTypeUrl();
onChanged();
return this;
}
/**
*
* Required.
*
*
* string type_url = 1;
*/
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;
/**
*
* Optional.
* If missing, it means the key type doesn't require a *KeyFormat proto.
*
*
* bytes value = 2;
*/
public com.google.protobuf.ByteString getValue() {
return value_;
}
/**
*
* Optional.
* If missing, it means the key type doesn't require a *KeyFormat proto.
*
*
* bytes value = 2;
*/
public Builder setValue(com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
value_ = value;
onChanged();
return this;
}
/**
*
* Optional.
* If missing, it means the key type doesn't require a *KeyFormat proto.
*
*
* bytes value = 2;
*/
public Builder clearValue() {
value_ = getDefaultInstance().getValue();
onChanged();
return this;
}
private int outputPrefixType_ = 0;
/**
*
* Optional.
* If missing, uses OutputPrefixType.TINK.
*
*
* .google.crypto.tink.OutputPrefixType output_prefix_type = 3;
*/
public int getOutputPrefixTypeValue() {
return outputPrefixType_;
}
/**
*
* Optional.
* If missing, uses OutputPrefixType.TINK.
*
*
* .google.crypto.tink.OutputPrefixType output_prefix_type = 3;
*/
public Builder setOutputPrefixTypeValue(int value) {
outputPrefixType_ = value;
onChanged();
return this;
}
/**
*
* Optional.
* If missing, uses OutputPrefixType.TINK.
*
*
* .google.crypto.tink.OutputPrefixType output_prefix_type = 3;
*/
public com.google.crypto.tink.proto.OutputPrefixType getOutputPrefixType() {
@SuppressWarnings("deprecation")
com.google.crypto.tink.proto.OutputPrefixType result = com.google.crypto.tink.proto.OutputPrefixType.valueOf(outputPrefixType_);
return result == null ? com.google.crypto.tink.proto.OutputPrefixType.UNRECOGNIZED : result;
}
/**
*
* Optional.
* If missing, uses OutputPrefixType.TINK.
*
*
* .google.crypto.tink.OutputPrefixType output_prefix_type = 3;
*/
public Builder setOutputPrefixType(com.google.crypto.tink.proto.OutputPrefixType value) {
if (value == null) {
throw new NullPointerException();
}
outputPrefixType_ = value.getNumber();
onChanged();
return this;
}
/**
*
* Optional.
* If missing, uses OutputPrefixType.TINK.
*
*
* .google.crypto.tink.OutputPrefixType output_prefix_type = 3;
*/
public Builder clearOutputPrefixType() {
outputPrefixType_ = 0;
onChanged();
return this;
}
@java.lang.Override
public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.setUnknownFieldsProto3(unknownFields);
}
@java.lang.Override
public final Builder mergeUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.mergeUnknownFields(unknownFields);
}
// @@protoc_insertion_point(builder_scope:google.crypto.tink.KeyTemplate)
}
// @@protoc_insertion_point(class_scope:google.crypto.tink.KeyTemplate)
private static final com.google.crypto.tink.proto.KeyTemplate DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new com.google.crypto.tink.proto.KeyTemplate();
}
public static com.google.crypto.tink.proto.KeyTemplate getDefaultInstance() {
return DEFAULT_INSTANCE;
}
private static final com.google.protobuf.Parser
PARSER = new com.google.protobuf.AbstractParser() {
@java.lang.Override
public KeyTemplate parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new KeyTemplate(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 com.google.crypto.tink.proto.KeyTemplate getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
}