-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for verifying dsse-intoto
- Verification should be able to correctly validate a bundle as cryptographically valid (VerificationOptions.empty()) - Verifiers may also include signer identity during verification - Verifiers should extract the embedded attestation to do further analysis on the attestation. Sigstore-java does not process those in any way - There is no signing options for DSSE bundles Signed-off-by: Appu Goundan <[email protected]>
- Loading branch information
1 parent
602aa10
commit 5628daa
Showing
9 changed files
with
374 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
sigstore-java/src/main/java/dev/sigstore/dsse/InTotoPayload.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* Copyright 2024 The Sigstore Authors. | ||
* | ||
* 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. | ||
*/ | ||
package dev.sigstore.dsse; | ||
|
||
import static dev.sigstore.json.GsonSupplier.GSON; | ||
|
||
import com.google.gson.JsonElement; | ||
import dev.sigstore.bundle.Bundle.DsseEnvelope; | ||
import java.util.List; | ||
import java.util.Map; | ||
import org.immutables.gson.Gson; | ||
import org.immutables.value.Value.Immutable; | ||
|
||
@Gson.TypeAdapters | ||
@Immutable | ||
public interface InTotoPayload { | ||
|
||
String PAYLOAD_TYPE = "application/vnd.in-toto+json"; | ||
|
||
@Gson.Named("_type") | ||
String getType(); | ||
|
||
List<Subject> getSubject(); | ||
|
||
String getPredicateType(); | ||
|
||
/** | ||
* Predicate is not processed by this library, if you want to inspect the contents of an | ||
* attestation, you want to use an attestation parser. | ||
*/ | ||
JsonElement getPredicate(); | ||
|
||
@Immutable | ||
interface Subject { | ||
|
||
String getName(); | ||
|
||
Map<String, String> getDigest(); | ||
} | ||
|
||
static InTotoPayload from(DsseEnvelope dsseEnvelope) { | ||
return GSON.get().fromJson(dsseEnvelope.getPayload(), InTotoPayload.class); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.