// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: google/devtools/containeranalysis/v1beta1/attestation/attestation.proto

package io.grafeas.v1beta1.attestation;

/**
 * <pre>
 * An attestation wrapper with a PGP-compatible signature. This message only
 * supports `ATTACHED` signatures, where the payload that is signed is included
 * alongside the signature itself in the same file.
 * </pre>
 *
 * Protobuf type {@code grafeas.v1beta1.attestation.PgpSignedAttestation}
 */
public  final class PgpSignedAttestation extends
    com.google.protobuf.GeneratedMessageV3 implements
    // @@protoc_insertion_point(message_implements:grafeas.v1beta1.attestation.PgpSignedAttestation)
    PgpSignedAttestationOrBuilder {
private static final long serialVersionUID = 0L;
  // Use PgpSignedAttestation.newBuilder() to construct.
  private PgpSignedAttestation(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
    super(builder);
  }
  private PgpSignedAttestation() {
    signature_ = "";
    contentType_ = 0;
  }

  @java.lang.Override
  public final com.google.protobuf.UnknownFieldSet
  getUnknownFields() {
    return this.unknownFields;
  }
  private PgpSignedAttestation(
      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();

            signature_ = s;
            break;
          }
          case 18: {
            java.lang.String s = input.readStringRequireUtf8();
            keyIdCase_ = 2;
            keyId_ = s;
            break;
          }
          case 24: {
            int rawValue = input.readEnum();

            contentType_ = 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 io.grafeas.v1beta1.attestation.AttestationOuterClass.internal_static_grafeas_v1beta1_attestation_PgpSignedAttestation_descriptor;
  }

  @java.lang.Override
  protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return io.grafeas.v1beta1.attestation.AttestationOuterClass.internal_static_grafeas_v1beta1_attestation_PgpSignedAttestation_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            io.grafeas.v1beta1.attestation.PgpSignedAttestation.class, io.grafeas.v1beta1.attestation.PgpSignedAttestation.Builder.class);
  }

  /**
   * <pre>
   * Type (for example schema) of the attestation payload that was signed.
   * </pre>
   *
   * Protobuf enum {@code grafeas.v1beta1.attestation.PgpSignedAttestation.ContentType}
   */
  public enum ContentType
      implements com.google.protobuf.ProtocolMessageEnum {
    /**
     * <pre>
     * `ContentType` is not set.
     * </pre>
     *
     * <code>CONTENT_TYPE_UNSPECIFIED = 0;</code>
     */
    CONTENT_TYPE_UNSPECIFIED(0),
    /**
     * <pre>
     * Atomic format attestation signature. See
     * https://github.com/containers/image/blob/8a5d2f82a6e3263290c8e0276c3e0f64e77723e7/docs/atomic-signature.md
     * The payload extracted from `signature` is a JSON blob conforming to the
     * linked schema.
     * </pre>
     *
     * <code>SIMPLE_SIGNING_JSON = 1;</code>
     */
    SIMPLE_SIGNING_JSON(1),
    UNRECOGNIZED(-1),
    ;

    /**
     * <pre>
     * `ContentType` is not set.
     * </pre>
     *
     * <code>CONTENT_TYPE_UNSPECIFIED = 0;</code>
     */
    public static final int CONTENT_TYPE_UNSPECIFIED_VALUE = 0;
    /**
     * <pre>
     * Atomic format attestation signature. See
     * https://github.com/containers/image/blob/8a5d2f82a6e3263290c8e0276c3e0f64e77723e7/docs/atomic-signature.md
     * The payload extracted from `signature` is a JSON blob conforming to the
     * linked schema.
     * </pre>
     *
     * <code>SIMPLE_SIGNING_JSON = 1;</code>
     */
    public static final int SIMPLE_SIGNING_JSON_VALUE = 1;


    public final int getNumber() {
      if (this == UNRECOGNIZED) {
        throw new java.lang.IllegalArgumentException(
            "Can't get the number of an unknown enum value.");
      }
      return value;
    }

    /**
     * @deprecated Use {@link #forNumber(int)} instead.
     */
    @java.lang.Deprecated
    public static ContentType valueOf(int value) {
      return forNumber(value);
    }

    public static ContentType forNumber(int value) {
      switch (value) {
        case 0: return CONTENT_TYPE_UNSPECIFIED;
        case 1: return SIMPLE_SIGNING_JSON;
        default: return null;
      }
    }

    public static com.google.protobuf.Internal.EnumLiteMap<ContentType>
        internalGetValueMap() {
      return internalValueMap;
    }
    private static final com.google.protobuf.Internal.EnumLiteMap<
        ContentType> internalValueMap =
          new com.google.protobuf.Internal.EnumLiteMap<ContentType>() {
            public ContentType findValueByNumber(int number) {
              return ContentType.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 io.grafeas.v1beta1.attestation.PgpSignedAttestation.getDescriptor().getEnumTypes().get(0);
    }

    private static final ContentType[] VALUES = values();

    public static ContentType 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 ContentType(int value) {
      this.value = value;
    }

    // @@protoc_insertion_point(enum_scope:grafeas.v1beta1.attestation.PgpSignedAttestation.ContentType)
  }

  private int keyIdCase_ = 0;
  private java.lang.Object keyId_;
  public enum KeyIdCase
      implements com.google.protobuf.Internal.EnumLite {
    PGP_KEY_ID(2),
    KEYID_NOT_SET(0);
    private final int value;
    private KeyIdCase(int value) {
      this.value = value;
    }
    /**
     * @deprecated Use {@link #forNumber(int)} instead.
     */
    @java.lang.Deprecated
    public static KeyIdCase valueOf(int value) {
      return forNumber(value);
    }

    public static KeyIdCase forNumber(int value) {
      switch (value) {
        case 2: return PGP_KEY_ID;
        case 0: return KEYID_NOT_SET;
        default: return null;
      }
    }
    public int getNumber() {
      return this.value;
    }
  };

  public KeyIdCase
  getKeyIdCase() {
    return KeyIdCase.forNumber(
        keyIdCase_);
  }

  public static final int SIGNATURE_FIELD_NUMBER = 1;
  private volatile java.lang.Object signature_;
  /**
   * <pre>
   * The raw content of the signature, as output by GNU Privacy Guard (GPG) or
   * equivalent.  Since this message only supports attached signatures, the
   * payload that was signed must be attached. While the signature format
   * supported is dependent on the verification implementation, currently only
   * ASCII-armored (`--armor` to gpg), non-clearsigned (`--sign` rather than
   * `--clearsign` to gpg) are supported. Concretely, `gpg --sign --armor
   * --output=signature.gpg payload.json` will create the signature content
   * expected in this field in `signature.gpg` for the `payload.json`
   * attestation payload.
   * </pre>
   *
   * <code>string signature = 1;</code>
   */
  public java.lang.String getSignature() {
    java.lang.Object ref = signature_;
    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();
      signature_ = s;
      return s;
    }
  }
  /**
   * <pre>
   * The raw content of the signature, as output by GNU Privacy Guard (GPG) or
   * equivalent.  Since this message only supports attached signatures, the
   * payload that was signed must be attached. While the signature format
   * supported is dependent on the verification implementation, currently only
   * ASCII-armored (`--armor` to gpg), non-clearsigned (`--sign` rather than
   * `--clearsign` to gpg) are supported. Concretely, `gpg --sign --armor
   * --output=signature.gpg payload.json` will create the signature content
   * expected in this field in `signature.gpg` for the `payload.json`
   * attestation payload.
   * </pre>
   *
   * <code>string signature = 1;</code>
   */
  public com.google.protobuf.ByteString
      getSignatureBytes() {
    java.lang.Object ref = signature_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b = 
          com.google.protobuf.ByteString.copyFromUtf8(
              (java.lang.String) ref);
      signature_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int CONTENT_TYPE_FIELD_NUMBER = 3;
  private int contentType_;
  /**
   * <pre>
   * Type (for example schema) of the attestation payload that was signed.
   * The verifier must ensure that the provided type is one that the verifier
   * supports, and that the attestation payload is a valid instantiation of that
   * type (for example by validating a JSON schema).
   * </pre>
   *
   * <code>.grafeas.v1beta1.attestation.PgpSignedAttestation.ContentType content_type = 3;</code>
   */
  public int getContentTypeValue() {
    return contentType_;
  }
  /**
   * <pre>
   * Type (for example schema) of the attestation payload that was signed.
   * The verifier must ensure that the provided type is one that the verifier
   * supports, and that the attestation payload is a valid instantiation of that
   * type (for example by validating a JSON schema).
   * </pre>
   *
   * <code>.grafeas.v1beta1.attestation.PgpSignedAttestation.ContentType content_type = 3;</code>
   */
  public io.grafeas.v1beta1.attestation.PgpSignedAttestation.ContentType getContentType() {
    @SuppressWarnings("deprecation")
    io.grafeas.v1beta1.attestation.PgpSignedAttestation.ContentType result = io.grafeas.v1beta1.attestation.PgpSignedAttestation.ContentType.valueOf(contentType_);
    return result == null ? io.grafeas.v1beta1.attestation.PgpSignedAttestation.ContentType.UNRECOGNIZED : result;
  }

  public static final int PGP_KEY_ID_FIELD_NUMBER = 2;
  /**
   * <pre>
   * The cryptographic fingerprint of the key used to generate the signature,
   * as output by, e.g. `gpg --list-keys`. This should be the version 4, full
   * 160-bit fingerprint, expressed as a 40 character hexidecimal string. See
   * https://tools.ietf.org/html/rfc4880#section-12.2 for details.
   * Implementations may choose to acknowledge "LONG", "SHORT", or other
   * abbreviated key IDs, but only the full fingerprint is guaranteed to work.
   * In gpg, the full fingerprint can be retrieved from the `fpr` field
   * returned when calling --list-keys with --with-colons.  For example:
   * ```
   * gpg --with-colons --with-fingerprint --force-v4-certs &#92;
   *     --list-keys attester&#64;example.com
   * tru::1:1513631572:0:3:1:5
   * pub:...&lt;SNIP&gt;...
   * fpr:::::::::24FF6481B76AC91E66A00AC657A93A81EF3AE6FB:
   * ```
   * Above, the fingerprint is `24FF6481B76AC91E66A00AC657A93A81EF3AE6FB`.
   * </pre>
   *
   * <code>string pgp_key_id = 2;</code>
   */
  public java.lang.String getPgpKeyId() {
    java.lang.Object ref = "";
    if (keyIdCase_ == 2) {
      ref = keyId_;
    }
    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();
      if (keyIdCase_ == 2) {
        keyId_ = s;
      }
      return s;
    }
  }
  /**
   * <pre>
   * The cryptographic fingerprint of the key used to generate the signature,
   * as output by, e.g. `gpg --list-keys`. This should be the version 4, full
   * 160-bit fingerprint, expressed as a 40 character hexidecimal string. See
   * https://tools.ietf.org/html/rfc4880#section-12.2 for details.
   * Implementations may choose to acknowledge "LONG", "SHORT", or other
   * abbreviated key IDs, but only the full fingerprint is guaranteed to work.
   * In gpg, the full fingerprint can be retrieved from the `fpr` field
   * returned when calling --list-keys with --with-colons.  For example:
   * ```
   * gpg --with-colons --with-fingerprint --force-v4-certs &#92;
   *     --list-keys attester&#64;example.com
   * tru::1:1513631572:0:3:1:5
   * pub:...&lt;SNIP&gt;...
   * fpr:::::::::24FF6481B76AC91E66A00AC657A93A81EF3AE6FB:
   * ```
   * Above, the fingerprint is `24FF6481B76AC91E66A00AC657A93A81EF3AE6FB`.
   * </pre>
   *
   * <code>string pgp_key_id = 2;</code>
   */
  public com.google.protobuf.ByteString
      getPgpKeyIdBytes() {
    java.lang.Object ref = "";
    if (keyIdCase_ == 2) {
      ref = keyId_;
    }
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b = 
          com.google.protobuf.ByteString.copyFromUtf8(
              (java.lang.String) ref);
      if (keyIdCase_ == 2) {
        keyId_ = b;
      }
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  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 (!getSignatureBytes().isEmpty()) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 1, signature_);
    }
    if (keyIdCase_ == 2) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 2, keyId_);
    }
    if (contentType_ != io.grafeas.v1beta1.attestation.PgpSignedAttestation.ContentType.CONTENT_TYPE_UNSPECIFIED.getNumber()) {
      output.writeEnum(3, contentType_);
    }
    unknownFields.writeTo(output);
  }

  @java.lang.Override
  public int getSerializedSize() {
    int size = memoizedSize;
    if (size != -1) return size;

    size = 0;
    if (!getSignatureBytes().isEmpty()) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, signature_);
    }
    if (keyIdCase_ == 2) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, keyId_);
    }
    if (contentType_ != io.grafeas.v1beta1.attestation.PgpSignedAttestation.ContentType.CONTENT_TYPE_UNSPECIFIED.getNumber()) {
      size += com.google.protobuf.CodedOutputStream
        .computeEnumSize(3, contentType_);
    }
    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.grafeas.v1beta1.attestation.PgpSignedAttestation)) {
      return super.equals(obj);
    }
    io.grafeas.v1beta1.attestation.PgpSignedAttestation other = (io.grafeas.v1beta1.attestation.PgpSignedAttestation) obj;

    boolean result = true;
    result = result && getSignature()
        .equals(other.getSignature());
    result = result && contentType_ == other.contentType_;
    result = result && getKeyIdCase().equals(
        other.getKeyIdCase());
    if (!result) return false;
    switch (keyIdCase_) {
      case 2:
        result = result && getPgpKeyId()
            .equals(other.getPgpKeyId());
        break;
      case 0:
      default:
    }
    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) + SIGNATURE_FIELD_NUMBER;
    hash = (53 * hash) + getSignature().hashCode();
    hash = (37 * hash) + CONTENT_TYPE_FIELD_NUMBER;
    hash = (53 * hash) + contentType_;
    switch (keyIdCase_) {
      case 2:
        hash = (37 * hash) + PGP_KEY_ID_FIELD_NUMBER;
        hash = (53 * hash) + getPgpKeyId().hashCode();
        break;
      case 0:
      default:
    }
    hash = (29 * hash) + unknownFields.hashCode();
    memoizedHashCode = hash;
    return hash;
  }

  public static io.grafeas.v1beta1.attestation.PgpSignedAttestation parseFrom(
      java.nio.ByteBuffer data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static io.grafeas.v1beta1.attestation.PgpSignedAttestation parseFrom(
      java.nio.ByteBuffer data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }
  public static io.grafeas.v1beta1.attestation.PgpSignedAttestation parseFrom(
      com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static io.grafeas.v1beta1.attestation.PgpSignedAttestation parseFrom(
      com.google.protobuf.ByteString data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }
  public static io.grafeas.v1beta1.attestation.PgpSignedAttestation parseFrom(byte[] data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static io.grafeas.v1beta1.attestation.PgpSignedAttestation parseFrom(
      byte[] data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }
  public static io.grafeas.v1beta1.attestation.PgpSignedAttestation parseFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input);
  }
  public static io.grafeas.v1beta1.attestation.PgpSignedAttestation 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.grafeas.v1beta1.attestation.PgpSignedAttestation parseDelimitedFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseDelimitedWithIOException(PARSER, input);
  }
  public static io.grafeas.v1beta1.attestation.PgpSignedAttestation 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.grafeas.v1beta1.attestation.PgpSignedAttestation parseFrom(
      com.google.protobuf.CodedInputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input);
  }
  public static io.grafeas.v1beta1.attestation.PgpSignedAttestation 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.grafeas.v1beta1.attestation.PgpSignedAttestation 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;
  }
  /**
   * <pre>
   * An attestation wrapper with a PGP-compatible signature. This message only
   * supports `ATTACHED` signatures, where the payload that is signed is included
   * alongside the signature itself in the same file.
   * </pre>
   *
   * Protobuf type {@code grafeas.v1beta1.attestation.PgpSignedAttestation}
   */
  public static final class Builder extends
      com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
      // @@protoc_insertion_point(builder_implements:grafeas.v1beta1.attestation.PgpSignedAttestation)
      io.grafeas.v1beta1.attestation.PgpSignedAttestationOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor
        getDescriptor() {
      return io.grafeas.v1beta1.attestation.AttestationOuterClass.internal_static_grafeas_v1beta1_attestation_PgpSignedAttestation_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return io.grafeas.v1beta1.attestation.AttestationOuterClass.internal_static_grafeas_v1beta1_attestation_PgpSignedAttestation_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              io.grafeas.v1beta1.attestation.PgpSignedAttestation.class, io.grafeas.v1beta1.attestation.PgpSignedAttestation.Builder.class);
    }

    // Construct using io.grafeas.v1beta1.attestation.PgpSignedAttestation.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();
      signature_ = "";

      contentType_ = 0;

      keyIdCase_ = 0;
      keyId_ = null;
      return this;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.Descriptor
        getDescriptorForType() {
      return io.grafeas.v1beta1.attestation.AttestationOuterClass.internal_static_grafeas_v1beta1_attestation_PgpSignedAttestation_descriptor;
    }

    @java.lang.Override
    public io.grafeas.v1beta1.attestation.PgpSignedAttestation getDefaultInstanceForType() {
      return io.grafeas.v1beta1.attestation.PgpSignedAttestation.getDefaultInstance();
    }

    @java.lang.Override
    public io.grafeas.v1beta1.attestation.PgpSignedAttestation build() {
      io.grafeas.v1beta1.attestation.PgpSignedAttestation result = buildPartial();
      if (!result.isInitialized()) {
        throw newUninitializedMessageException(result);
      }
      return result;
    }

    @java.lang.Override
    public io.grafeas.v1beta1.attestation.PgpSignedAttestation buildPartial() {
      io.grafeas.v1beta1.attestation.PgpSignedAttestation result = new io.grafeas.v1beta1.attestation.PgpSignedAttestation(this);
      result.signature_ = signature_;
      result.contentType_ = contentType_;
      if (keyIdCase_ == 2) {
        result.keyId_ = keyId_;
      }
      result.keyIdCase_ = keyIdCase_;
      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 io.grafeas.v1beta1.attestation.PgpSignedAttestation) {
        return mergeFrom((io.grafeas.v1beta1.attestation.PgpSignedAttestation)other);
      } else {
        super.mergeFrom(other);
        return this;
      }
    }

    public Builder mergeFrom(io.grafeas.v1beta1.attestation.PgpSignedAttestation other) {
      if (other == io.grafeas.v1beta1.attestation.PgpSignedAttestation.getDefaultInstance()) return this;
      if (!other.getSignature().isEmpty()) {
        signature_ = other.signature_;
        onChanged();
      }
      if (other.contentType_ != 0) {
        setContentTypeValue(other.getContentTypeValue());
      }
      switch (other.getKeyIdCase()) {
        case PGP_KEY_ID: {
          keyIdCase_ = 2;
          keyId_ = other.keyId_;
          onChanged();
          break;
        }
        case KEYID_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.grafeas.v1beta1.attestation.PgpSignedAttestation parsedMessage = null;
      try {
        parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        parsedMessage = (io.grafeas.v1beta1.attestation.PgpSignedAttestation) e.getUnfinishedMessage();
        throw e.unwrapIOException();
      } finally {
        if (parsedMessage != null) {
          mergeFrom(parsedMessage);
        }
      }
      return this;
    }
    private int keyIdCase_ = 0;
    private java.lang.Object keyId_;
    public KeyIdCase
        getKeyIdCase() {
      return KeyIdCase.forNumber(
          keyIdCase_);
    }

    public Builder clearKeyId() {
      keyIdCase_ = 0;
      keyId_ = null;
      onChanged();
      return this;
    }


    private java.lang.Object signature_ = "";
    /**
     * <pre>
     * The raw content of the signature, as output by GNU Privacy Guard (GPG) or
     * equivalent.  Since this message only supports attached signatures, the
     * payload that was signed must be attached. While the signature format
     * supported is dependent on the verification implementation, currently only
     * ASCII-armored (`--armor` to gpg), non-clearsigned (`--sign` rather than
     * `--clearsign` to gpg) are supported. Concretely, `gpg --sign --armor
     * --output=signature.gpg payload.json` will create the signature content
     * expected in this field in `signature.gpg` for the `payload.json`
     * attestation payload.
     * </pre>
     *
     * <code>string signature = 1;</code>
     */
    public java.lang.String getSignature() {
      java.lang.Object ref = signature_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs =
            (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        signature_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     * <pre>
     * The raw content of the signature, as output by GNU Privacy Guard (GPG) or
     * equivalent.  Since this message only supports attached signatures, the
     * payload that was signed must be attached. While the signature format
     * supported is dependent on the verification implementation, currently only
     * ASCII-armored (`--armor` to gpg), non-clearsigned (`--sign` rather than
     * `--clearsign` to gpg) are supported. Concretely, `gpg --sign --armor
     * --output=signature.gpg payload.json` will create the signature content
     * expected in this field in `signature.gpg` for the `payload.json`
     * attestation payload.
     * </pre>
     *
     * <code>string signature = 1;</code>
     */
    public com.google.protobuf.ByteString
        getSignatureBytes() {
      java.lang.Object ref = signature_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b = 
            com.google.protobuf.ByteString.copyFromUtf8(
                (java.lang.String) ref);
        signature_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     * <pre>
     * The raw content of the signature, as output by GNU Privacy Guard (GPG) or
     * equivalent.  Since this message only supports attached signatures, the
     * payload that was signed must be attached. While the signature format
     * supported is dependent on the verification implementation, currently only
     * ASCII-armored (`--armor` to gpg), non-clearsigned (`--sign` rather than
     * `--clearsign` to gpg) are supported. Concretely, `gpg --sign --armor
     * --output=signature.gpg payload.json` will create the signature content
     * expected in this field in `signature.gpg` for the `payload.json`
     * attestation payload.
     * </pre>
     *
     * <code>string signature = 1;</code>
     */
    public Builder setSignature(
        java.lang.String value) {
      if (value == null) {
    throw new NullPointerException();
  }
  
      signature_ = value;
      onChanged();
      return this;
    }
    /**
     * <pre>
     * The raw content of the signature, as output by GNU Privacy Guard (GPG) or
     * equivalent.  Since this message only supports attached signatures, the
     * payload that was signed must be attached. While the signature format
     * supported is dependent on the verification implementation, currently only
     * ASCII-armored (`--armor` to gpg), non-clearsigned (`--sign` rather than
     * `--clearsign` to gpg) are supported. Concretely, `gpg --sign --armor
     * --output=signature.gpg payload.json` will create the signature content
     * expected in this field in `signature.gpg` for the `payload.json`
     * attestation payload.
     * </pre>
     *
     * <code>string signature = 1;</code>
     */
    public Builder clearSignature() {
      
      signature_ = getDefaultInstance().getSignature();
      onChanged();
      return this;
    }
    /**
     * <pre>
     * The raw content of the signature, as output by GNU Privacy Guard (GPG) or
     * equivalent.  Since this message only supports attached signatures, the
     * payload that was signed must be attached. While the signature format
     * supported is dependent on the verification implementation, currently only
     * ASCII-armored (`--armor` to gpg), non-clearsigned (`--sign` rather than
     * `--clearsign` to gpg) are supported. Concretely, `gpg --sign --armor
     * --output=signature.gpg payload.json` will create the signature content
     * expected in this field in `signature.gpg` for the `payload.json`
     * attestation payload.
     * </pre>
     *
     * <code>string signature = 1;</code>
     */
    public Builder setSignatureBytes(
        com.google.protobuf.ByteString value) {
      if (value == null) {
    throw new NullPointerException();
  }
  checkByteStringIsUtf8(value);
      
      signature_ = value;
      onChanged();
      return this;
    }

    private int contentType_ = 0;
    /**
     * <pre>
     * Type (for example schema) of the attestation payload that was signed.
     * The verifier must ensure that the provided type is one that the verifier
     * supports, and that the attestation payload is a valid instantiation of that
     * type (for example by validating a JSON schema).
     * </pre>
     *
     * <code>.grafeas.v1beta1.attestation.PgpSignedAttestation.ContentType content_type = 3;</code>
     */
    public int getContentTypeValue() {
      return contentType_;
    }
    /**
     * <pre>
     * Type (for example schema) of the attestation payload that was signed.
     * The verifier must ensure that the provided type is one that the verifier
     * supports, and that the attestation payload is a valid instantiation of that
     * type (for example by validating a JSON schema).
     * </pre>
     *
     * <code>.grafeas.v1beta1.attestation.PgpSignedAttestation.ContentType content_type = 3;</code>
     */
    public Builder setContentTypeValue(int value) {
      contentType_ = value;
      onChanged();
      return this;
    }
    /**
     * <pre>
     * Type (for example schema) of the attestation payload that was signed.
     * The verifier must ensure that the provided type is one that the verifier
     * supports, and that the attestation payload is a valid instantiation of that
     * type (for example by validating a JSON schema).
     * </pre>
     *
     * <code>.grafeas.v1beta1.attestation.PgpSignedAttestation.ContentType content_type = 3;</code>
     */
    public io.grafeas.v1beta1.attestation.PgpSignedAttestation.ContentType getContentType() {
      @SuppressWarnings("deprecation")
      io.grafeas.v1beta1.attestation.PgpSignedAttestation.ContentType result = io.grafeas.v1beta1.attestation.PgpSignedAttestation.ContentType.valueOf(contentType_);
      return result == null ? io.grafeas.v1beta1.attestation.PgpSignedAttestation.ContentType.UNRECOGNIZED : result;
    }
    /**
     * <pre>
     * Type (for example schema) of the attestation payload that was signed.
     * The verifier must ensure that the provided type is one that the verifier
     * supports, and that the attestation payload is a valid instantiation of that
     * type (for example by validating a JSON schema).
     * </pre>
     *
     * <code>.grafeas.v1beta1.attestation.PgpSignedAttestation.ContentType content_type = 3;</code>
     */
    public Builder setContentType(io.grafeas.v1beta1.attestation.PgpSignedAttestation.ContentType value) {
      if (value == null) {
        throw new NullPointerException();
      }
      
      contentType_ = value.getNumber();
      onChanged();
      return this;
    }
    /**
     * <pre>
     * Type (for example schema) of the attestation payload that was signed.
     * The verifier must ensure that the provided type is one that the verifier
     * supports, and that the attestation payload is a valid instantiation of that
     * type (for example by validating a JSON schema).
     * </pre>
     *
     * <code>.grafeas.v1beta1.attestation.PgpSignedAttestation.ContentType content_type = 3;</code>
     */
    public Builder clearContentType() {
      
      contentType_ = 0;
      onChanged();
      return this;
    }

    /**
     * <pre>
     * The cryptographic fingerprint of the key used to generate the signature,
     * as output by, e.g. `gpg --list-keys`. This should be the version 4, full
     * 160-bit fingerprint, expressed as a 40 character hexidecimal string. See
     * https://tools.ietf.org/html/rfc4880#section-12.2 for details.
     * Implementations may choose to acknowledge "LONG", "SHORT", or other
     * abbreviated key IDs, but only the full fingerprint is guaranteed to work.
     * In gpg, the full fingerprint can be retrieved from the `fpr` field
     * returned when calling --list-keys with --with-colons.  For example:
     * ```
     * gpg --with-colons --with-fingerprint --force-v4-certs &#92;
     *     --list-keys attester&#64;example.com
     * tru::1:1513631572:0:3:1:5
     * pub:...&lt;SNIP&gt;...
     * fpr:::::::::24FF6481B76AC91E66A00AC657A93A81EF3AE6FB:
     * ```
     * Above, the fingerprint is `24FF6481B76AC91E66A00AC657A93A81EF3AE6FB`.
     * </pre>
     *
     * <code>string pgp_key_id = 2;</code>
     */
    public java.lang.String getPgpKeyId() {
      java.lang.Object ref = "";
      if (keyIdCase_ == 2) {
        ref = keyId_;
      }
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs =
            (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        if (keyIdCase_ == 2) {
          keyId_ = s;
        }
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     * <pre>
     * The cryptographic fingerprint of the key used to generate the signature,
     * as output by, e.g. `gpg --list-keys`. This should be the version 4, full
     * 160-bit fingerprint, expressed as a 40 character hexidecimal string. See
     * https://tools.ietf.org/html/rfc4880#section-12.2 for details.
     * Implementations may choose to acknowledge "LONG", "SHORT", or other
     * abbreviated key IDs, but only the full fingerprint is guaranteed to work.
     * In gpg, the full fingerprint can be retrieved from the `fpr` field
     * returned when calling --list-keys with --with-colons.  For example:
     * ```
     * gpg --with-colons --with-fingerprint --force-v4-certs &#92;
     *     --list-keys attester&#64;example.com
     * tru::1:1513631572:0:3:1:5
     * pub:...&lt;SNIP&gt;...
     * fpr:::::::::24FF6481B76AC91E66A00AC657A93A81EF3AE6FB:
     * ```
     * Above, the fingerprint is `24FF6481B76AC91E66A00AC657A93A81EF3AE6FB`.
     * </pre>
     *
     * <code>string pgp_key_id = 2;</code>
     */
    public com.google.protobuf.ByteString
        getPgpKeyIdBytes() {
      java.lang.Object ref = "";
      if (keyIdCase_ == 2) {
        ref = keyId_;
      }
      if (ref instanceof String) {
        com.google.protobuf.ByteString b = 
            com.google.protobuf.ByteString.copyFromUtf8(
                (java.lang.String) ref);
        if (keyIdCase_ == 2) {
          keyId_ = b;
        }
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     * <pre>
     * The cryptographic fingerprint of the key used to generate the signature,
     * as output by, e.g. `gpg --list-keys`. This should be the version 4, full
     * 160-bit fingerprint, expressed as a 40 character hexidecimal string. See
     * https://tools.ietf.org/html/rfc4880#section-12.2 for details.
     * Implementations may choose to acknowledge "LONG", "SHORT", or other
     * abbreviated key IDs, but only the full fingerprint is guaranteed to work.
     * In gpg, the full fingerprint can be retrieved from the `fpr` field
     * returned when calling --list-keys with --with-colons.  For example:
     * ```
     * gpg --with-colons --with-fingerprint --force-v4-certs &#92;
     *     --list-keys attester&#64;example.com
     * tru::1:1513631572:0:3:1:5
     * pub:...&lt;SNIP&gt;...
     * fpr:::::::::24FF6481B76AC91E66A00AC657A93A81EF3AE6FB:
     * ```
     * Above, the fingerprint is `24FF6481B76AC91E66A00AC657A93A81EF3AE6FB`.
     * </pre>
     *
     * <code>string pgp_key_id = 2;</code>
     */
    public Builder setPgpKeyId(
        java.lang.String value) {
      if (value == null) {
    throw new NullPointerException();
  }
  keyIdCase_ = 2;
      keyId_ = value;
      onChanged();
      return this;
    }
    /**
     * <pre>
     * The cryptographic fingerprint of the key used to generate the signature,
     * as output by, e.g. `gpg --list-keys`. This should be the version 4, full
     * 160-bit fingerprint, expressed as a 40 character hexidecimal string. See
     * https://tools.ietf.org/html/rfc4880#section-12.2 for details.
     * Implementations may choose to acknowledge "LONG", "SHORT", or other
     * abbreviated key IDs, but only the full fingerprint is guaranteed to work.
     * In gpg, the full fingerprint can be retrieved from the `fpr` field
     * returned when calling --list-keys with --with-colons.  For example:
     * ```
     * gpg --with-colons --with-fingerprint --force-v4-certs &#92;
     *     --list-keys attester&#64;example.com
     * tru::1:1513631572:0:3:1:5
     * pub:...&lt;SNIP&gt;...
     * fpr:::::::::24FF6481B76AC91E66A00AC657A93A81EF3AE6FB:
     * ```
     * Above, the fingerprint is `24FF6481B76AC91E66A00AC657A93A81EF3AE6FB`.
     * </pre>
     *
     * <code>string pgp_key_id = 2;</code>
     */
    public Builder clearPgpKeyId() {
      if (keyIdCase_ == 2) {
        keyIdCase_ = 0;
        keyId_ = null;
        onChanged();
      }
      return this;
    }
    /**
     * <pre>
     * The cryptographic fingerprint of the key used to generate the signature,
     * as output by, e.g. `gpg --list-keys`. This should be the version 4, full
     * 160-bit fingerprint, expressed as a 40 character hexidecimal string. See
     * https://tools.ietf.org/html/rfc4880#section-12.2 for details.
     * Implementations may choose to acknowledge "LONG", "SHORT", or other
     * abbreviated key IDs, but only the full fingerprint is guaranteed to work.
     * In gpg, the full fingerprint can be retrieved from the `fpr` field
     * returned when calling --list-keys with --with-colons.  For example:
     * ```
     * gpg --with-colons --with-fingerprint --force-v4-certs &#92;
     *     --list-keys attester&#64;example.com
     * tru::1:1513631572:0:3:1:5
     * pub:...&lt;SNIP&gt;...
     * fpr:::::::::24FF6481B76AC91E66A00AC657A93A81EF3AE6FB:
     * ```
     * Above, the fingerprint is `24FF6481B76AC91E66A00AC657A93A81EF3AE6FB`.
     * </pre>
     *
     * <code>string pgp_key_id = 2;</code>
     */
    public Builder setPgpKeyIdBytes(
        com.google.protobuf.ByteString value) {
      if (value == null) {
    throw new NullPointerException();
  }
  checkByteStringIsUtf8(value);
      keyIdCase_ = 2;
      keyId_ = value;
      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:grafeas.v1beta1.attestation.PgpSignedAttestation)
  }

  // @@protoc_insertion_point(class_scope:grafeas.v1beta1.attestation.PgpSignedAttestation)
  private static final io.grafeas.v1beta1.attestation.PgpSignedAttestation DEFAULT_INSTANCE;
  static {
    DEFAULT_INSTANCE = new io.grafeas.v1beta1.attestation.PgpSignedAttestation();
  }

  public static io.grafeas.v1beta1.attestation.PgpSignedAttestation getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

  private static final com.google.protobuf.Parser<PgpSignedAttestation>
      PARSER = new com.google.protobuf.AbstractParser<PgpSignedAttestation>() {
    @java.lang.Override
    public PgpSignedAttestation parsePartialFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return new PgpSignedAttestation(input, extensionRegistry);
    }
  };

  public static com.google.protobuf.Parser<PgpSignedAttestation> parser() {
    return PARSER;
  }

  @java.lang.Override
  public com.google.protobuf.Parser<PgpSignedAttestation> getParserForType() {
    return PARSER;
  }

  @java.lang.Override
  public io.grafeas.v1beta1.attestation.PgpSignedAttestation getDefaultInstanceForType() {
    return DEFAULT_INSTANCE;
  }

}

