Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion sigstore-java/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ plugins {

description = "A Java client for signing and verifying using Sigstore"

tasks.jar {
manifest {
// Name of the automatic module for JPMS consumers. It must never change once released.
attributes["Automatic-Module-Name"] = "dev.sigstore"
}
}

dependencies {
compileOnly("org.immutables:gson:2.12.2")
compileOnly("org.immutables:value-annotations:2.12.2")
Expand All @@ -21,9 +28,15 @@ dependencies {

implementation("io.github.erdtman:java-json-canonicalization:1.1")

// this requires inclusion of protos is src/main/proto
// the protos in this artifact are compiled into sigstore-java, alongside src/main/proto
protobuf("dev.sigstore:protobuf-specs:0.5.0")

// Supplies the google/api protos imported by fulcio.proto and protobuf-specs, both as
// sources on the protoc include path and as the com.google.api classes that generated
// code and BundleVerifier link against. These were previously compiled from copies in
// src/main/proto, which duplicated classes this artifact already provides.
implementation("com.google.api.grpc:proto-google-common-protos:2.74.0")

implementation(platform("com.google.protobuf:protobuf-bom:4.35.1"))
implementation("com.google.protobuf:protobuf-java-util")

Expand Down Expand Up @@ -58,6 +71,15 @@ dependencies {
testRuntimeOnly("io.github.netmikey.logunit:logunit-jul:2.0.0")
}

// src/main/proto/envelope.proto shadows the copy extracted from protobuf-specs, adding the
// java_package that upstream omits. Both sit at the same path relative to their --proto_path
// root, and protoc refuses an input it has shadowed, so drop the extracted one from the
// inputs. It stays on the include path, where src/main/proto is searched first, leaving
// imports of "envelope.proto" resolving to our copy.
sourceSets.main.get().extensions.getByName<SourceDirectorySet>("proto").exclude {
it.file.name == "envelope.proto" && "extracted-protos" in it.file.path
}

protobuf {
protoc {
artifact = "com.google.protobuf:protoc:4.35.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@
import dev.sigstore.proto.common.v1.MessageSignature;
import dev.sigstore.proto.common.v1.RFC3161SignedTimestamp;
import dev.sigstore.proto.common.v1.X509Certificate;
import dev.sigstore.proto.dsse.EnvelopeOuterClass.Envelope;
import dev.sigstore.proto.rekor.v1.Checkpoint;
import dev.sigstore.proto.rekor.v1.InclusionPromise;
import dev.sigstore.proto.rekor.v1.InclusionProof;
import dev.sigstore.proto.rekor.v1.KindVersion;
import dev.sigstore.proto.rekor.v1.TransparencyLogEntry;
import dev.sigstore.rekor.client.RekorEntry;
import io.intoto.EnvelopeOuterClass.Envelope;
import java.security.cert.CertificateEncodingException;
import java.util.Base64;
import java.util.List;
Expand Down Expand Up @@ -118,7 +118,7 @@ static dev.sigstore.proto.bundle.v1.Bundle.Builder createBundleBuilder(Bundle bu
.setPayloadType(dsseEnvelope.getPayloadType());
for (var sig : dsseEnvelope.getSignatures()) {
envelopeBuilder.addSignatures(
io.intoto.EnvelopeOuterClass.Signature.newBuilder()
dev.sigstore.proto.dsse.EnvelopeOuterClass.Signature.newBuilder()
.setSig(ByteString.copyFrom(sig.getSig()))
.build());
}
Expand Down
60 changes: 60 additions & 0 deletions sigstore-java/src/main/proto/envelope.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
// https://raw.githubusercontent.com/secure-systems-lab/dsse/9c813476bd36de70a5738c72e784f123ecea16af/envelope.proto

// 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.

// This is a copy of the envelope.proto carried by dev.sigstore:protobuf-specs, which
// takes precedence over the copy extracted from that artifact. It differs only by the
// java_package option below: upstream sets go_package and ruby_package but no Java
// equivalent, so protoc would otherwise emit these classes into io.intoto, a namespace
// sigstore does not own. The proto package is deliberately left alone, so the wire
// format and the io.intoto.Envelope descriptor name are unchanged.

syntax = "proto3";

package io.intoto;

option go_package = "github.com/sigstore/protobuf-specs/gen/pb-go/dsse";
option ruby_package = "Sigstore::DSSE";
option java_package = "dev.sigstore.proto.dsse";

// An authenticated message of arbitrary type.
message Envelope {
// Message to be signed. (In JSON, this is encoded as base64.)
// REQUIRED.
bytes payload = 1;

// String unambiguously identifying how to interpret payload.
// REQUIRED.
string payloadType = 2;

// Signature over:
// PAE(type, payload)
// Where PAE is defined as:
// PAE(type, payload) = "DSSEv1" + SP + LEN(type) + SP + type + SP + LEN(payload) + SP + payload
// + = concatenation
// SP = ASCII space [0x20]
// "DSSEv1" = ASCII [0x44, 0x53, 0x53, 0x45, 0x76, 0x31]
// LEN(s) = ASCII decimal encoding of the byte length of s, with no leading zeros
// REQUIRED (length >= 1).
repeated Signature signatures = 3;
}

message Signature {
// Signature itself. (In JSON, this is encoded as base64.)
// REQUIRED.
bytes sig = 1;

// *Unauthenticated* hint identifying which public key was used.
// OPTIONAL.
string keyid = 2;
}
10 changes: 0 additions & 10 deletions sigstore-java/src/main/proto/google/api/README.md

This file was deleted.

31 changes: 0 additions & 31 deletions sigstore-java/src/main/proto/google/api/annotations.proto

This file was deleted.

104 changes: 0 additions & 104 deletions sigstore-java/src/main/proto/google/api/field_behavior.proto

This file was deleted.

Loading