// Copyright 2016 Google LLC. All Rights Reserved.
//
// 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.

syntax = "proto3";

option go_package = "github.com/google/trillian/crypto/sigpb";

package sigpb;

// Protocol buffer encoding of the TLS DigitallySigned type, from RFC 5246 §4.7.
message DigitallySigned {
  // HashAlgorithm defines the approved methods for object hashing.
  //
  // Supported hash algorithms. The numbering space is the same as for TLS,
  // given in RFC 5246 s7.4.1.4.1 and at:
  // http://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#tls-parameters-18
  enum HashAlgorithm {
    // No hash algorithm is used.
    NONE = 0;
    // SHA256 is used.
    SHA256 = 4;
  }

  // SignatureAlgorithm defines the algorithm used to sign the object.
  //
  // Supported signature algorithms. The numbering space is the same as for TLS,
  // given in RFC 5246 s7.4.1.4.1 and at:
  // http://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#tls-parameters-16
  enum SignatureAlgorithm {
    // Anonymous signature scheme.
    ANONYMOUS = 0;
    // RSA signature scheme.
    RSA = 1;
    // ECDSA signature scheme.
    ECDSA = 3;
    // Ed25519 signature scheme.
    ED25519 = 7;
  }

  // hash_algorithm contains the hash algorithm used.
  HashAlgorithm hash_algorithm = 1;
  // sig_algorithm contains the signing algorithm used.
  SignatureAlgorithm signature_algorithm = 2;
  // signature contains the object signature.
  bytes signature = 3;
}
