GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - sigstore/sigstore-java: java clients for sigstore

BranchesTags
Open more actions menu

Latest commit

 

History

2,072 Commits
2,072 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
.idea
.idea
 
 
build-logic-commons
build-logic-commons
 
 
build-logic
build-logic
 
 
config
config
 
 
examples
examples
 
 
fuzzing
fuzzing
 
 
gradle/wrapper
gradle/wrapper
 
 
sandbox
sandbox
 
 
scripts
scripts
 
 
sigstore-cli
sigstore-cli
 
 
sigstore-common
sigstore-common
 
 
sigstore-gradle
sigstore-gradle
 
 
sigstore-http
sigstore-http
 
 
sigstore-java
sigstore-java
 
 
sigstore-maven-plugin
sigstore-maven-plugin
 
 
sigstore-testkit
sigstore-testkit
 
 
sigstore-tuf
sigstore-tuf
 
 
tuf-cli
tuf-cli
 
 
.editorconfig
.editorconfig
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
CHANGELOG.md
CHANGELOG.md
 
 
DEVELOPMENT.md
DEVELOPMENT.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
RELEASING.md
RELEASING.md
 
 
build.gradle.kts
build.gradle.kts
 
 
gradle.properties
gradle.properties
 
 
gradlew
gradlew
 
 
gradlew.bat
gradlew.bat
 
 
renovate.json
renovate.json
 
 
settings.gradle.kts
settings.gradle.kts
 
 

Repository files navigation

Maven Central javadoc CI

sigstore-java

A sigstore java client for interacting with sigstore infrastructure

You can file issues directly on this project or if you have any questions message us on the sigstore#java slack channel

Minimum Requirements

  • Java 11

Usage

Build plugins

For use directly with your java build. See maven or gradle build plugin specifics.

Keyless Signing And Verification

Artifact Signing

Path testArtifact = Paths.get("path/to/my/file.jar")

// sign using the sigstore public instance
var signer = KeylessSigner.builder().sigstorePublicDefaults().build();
Bundle result = signer.signFile(testArtifact);

// sigstore bundle format (serialized as <artifact>.sigstore.json)
String bundleJson = result.toJson();
ID Token

Signing will use identity tokens from these sources in the following order of priority:

  • SIGSTORE_JAVA_ID_TOKEN: a raw token provided as an environment variable
  • GitHub Actions: a token from github actions when the permission idtoken: write is set
  • Interactive Web Flow: an broswer based oidc flow requiring user input

Artifact Verification

Get artifact and bundle
Path artifact = Paths.get("path/to/my-artifact");

// import a json formatted sigstore bundle
Path bundleFile = Paths.get("path/to/my-artifact.sigstore.json");
Bundle bundle = Bundle.from(bundleFile, StandardCharsets.UTF_8);
Configure verification options
// add certificate policy to verify the identity of the signer
VerificationOptions options = VerificationOptions.builder().addCertificateMatchers(
  CertificateMatcher.fulcio()
    .subjectAlternativeName(StringMatcher.string("[email protected]"))
    .issuer(StringMatcher.string("https://accounts.example.com"))
    .build());
Do verification
try {
  // verify using the sigstore public instance
  var verifier = new KeylessVerifier.builder().sigstorePublicDefaults().build();
  verifier.verify(artifact, bundle, verificationOptions);
  // verification passed!
} catch (KeylessVerificationException e) {
  // verification failed
}

Attesting DSSE Payloads (only for testing on staging)

String payload = "<some https://in-toto.io/Statement/v1 statement>"

// sign using the Sigstore stating instance with rekor v2 explicitly enabled
var signer = KeylessSigner.builder().sigstoreStagingDefaults().enableRekorV2(true).build();
var result = signer.attest(payload);

// sigstore bundle format (serialized as <attestation>.sigstore.json)
String bundleJson = result.toJson();

Verifying DSSE Bundles

sigstore-java doesn't create DSSE bundles on the public good infrastructure yet, but it can verify the signatures over them with the same KeylessVerifier workflow detailed above. While sigstore-java inspects the embedded payload to ensure the provided artifact is a subject in the in-toto statement it is not able to make any further assertions about the payload. Consumers of DSSE bundles should inspect the embedded payload to verify extended attestation data using tools like slsa-verifier.

Exploring the API

The public stable API is limited to dev.sigstore.KeylessSigner and dev.sigstore.KeylessVerifier and the classes exposed by those APIs. Other classes in the library are subject to change without notice.

You can browse Javadoc at https://javadoc.io/doc/dev.sigstore/sigstore-java.

To build and view javadoc from the sources, use the following command:

$ ./gradlew javadoc
$ "my-favorite-browser" ./sigstore-java/build/docs/javadoc/index.html

Distribution

Sigstore Java and Sigstore Maven Plugin are signed with both PGP and sigstore.

PGP

Version Range Key Id
1.X.X 2c02310024baae4b34976ffeac74a3385d0e3252
2.X.X 300b49c14dfa7e0ad9d8515400e008229f5daf37

Sigstore

Version Range Issuer Signer Id
1.0.0 - 2.X.X https://token.actions.githubusercontent.com https://github.com/sigstore/sigstore-java/.github/workflows/release-sigstore-java-from-tag.yaml@refs/tags/X.X.X

Building locally

Building requires Java 21 to run Gradle, even though the main code stays Java 11 compatible and tests target Java 17. Point JAVA_HOME at a Java 21 install and run:

./gradlew build

Some tests start a local fulcio server, so install it on your PATH first:

go install github.com/sigstore/fulcio@main

Troubleshooting

To ensure maximum compatibility with the public Sigstore infrastructure, ensure you are using the latest release of sigstore-java.

Common issues

  1. Cannot verify bundles with timestamp verification material
    
    means an upgrade is necessary to verify this signature bundle as Rekor v2 log entries require external timestamps and can only be verified by sigstore-java 2.0.0 or higher.
  2. Cannot verify DSSE signature based bundles
    
    DSSE validation was introduced in sigstore-java 1.3.0, so older versions may throw this error.
  3. Returned log entry was inconsistent with request
    
    While this can be a legitimate error stemming from misconfigured infrastructure, it can also happen due to irregularities in handling line endings (\r\n) on Windows for sigstore-java 1.x.x. Upgrading to 2.0.0 or higher should solve this problem.
  4. Offline verification is unsupported. By default, sigstore-java checks for updates of the trusted key material when verifying and you may encounter errors like:
    TUF repo failed to update
    
    While this is not recommended when using public sigstore infrastructure, you can configure the KeylessVerifier to run in "offline" mode by programmatically configuring a SigstoreTrustedRoot (cached or custom) to bypass querying the TUF repository.
  5. Offline signing is unsupported and there are no workarounds.

My problem is something else

Please open an issue or ask in the #java slack channel.

About

java clients for sigstore

Resources

Readme
Apache-2.0 license

Code of conduct

Code of conduct

Contributing

Contributing

Security policy

Security policy
Activity
Custom properties

Stars

82 stars

Watchers

5 watching

Forks

37 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.