Package dev.sigstore

Class KeylessSigner

  • All Implemented Interfaces:
    java.lang.AutoCloseable

    public class KeylessSigner
    extends java.lang.Object
    implements java.lang.AutoCloseable
    A full sigstore keyless signing flow.

    Note: the implementation is thread-safe assuming the clients (Fulcio, OIDC, Rekor) are thread-safe

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  KeylessSigner.Builder  
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.time.Duration DEFAULT_MIN_SIGNING_CERTIFICATE_LIFETIME
      The instance of the KeylessSigner will try to reuse a previously acquired certificate if the expiration time on the certificate is more than minSigningCertificateLifetime time away.
    • Field Detail

      • DEFAULT_MIN_SIGNING_CERTIFICATE_LIFETIME

        public static final java.time.Duration DEFAULT_MIN_SIGNING_CERTIFICATE_LIFETIME
        The instance of the KeylessSigner will try to reuse a previously acquired certificate if the expiration time on the certificate is more than minSigningCertificateLifetime time away. Otherwise, it will make a new request (OIDC, Fulcio) to obtain a new updated certificate to use for signing. This is a default value for the remaining lifetime of the signing certificate that is considered good enough.
    • Method Detail

      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
      • sign

        @CheckReturnValue
        public java.util.List<Bundle> sign​(java.util.List<byte[]> artifactDigests)
                                    throws KeylessSignerException
        Sign one or more artifact digests using the keyless signing workflow. The oidc/fulcio dance to obtain a signing certificate will only occur once. The same ephemeral private key will be used to sign all artifacts. This method will renew certificates as they expire.
        Parameters:
        artifactDigests - sha256 digests of the artifacts to sign.
        Returns:
        a list of keyless singing results.
        Throws:
        KeylessSignerException
      • signFiles

        @CheckReturnValue
        public java.util.Map<java.nio.file.Path,​Bundle> signFiles​(java.util.List<java.nio.file.Path> artifacts)
                                                                 throws KeylessSignerException
        Convenience wrapper around sign(List) to accept files instead of digests
        Parameters:
        artifacts - list of the artifacts to sign.
        Returns:
        a map of artifacts and their keyless singing results.
        Throws:
        KeylessSignerException