...

Source file src/github.com/docker/distribution/manifest/schema1/verify.go

Documentation: github.com/docker/distribution/manifest/schema1

     1  package schema1
     2  
     3  import (
     4  	"crypto/x509"
     5  
     6  	"github.com/docker/libtrust"
     7  	"github.com/sirupsen/logrus"
     8  )
     9  
    10  // Verify verifies the signature of the signed manifest returning the public
    11  // keys used during signing.
    12  func Verify(sm *SignedManifest) ([]libtrust.PublicKey, error) {
    13  	js, err := libtrust.ParsePrettySignature(sm.all, "signatures")
    14  	if err != nil {
    15  		logrus.WithField("err", err).Debugf("(*SignedManifest).Verify")
    16  		return nil, err
    17  	}
    18  
    19  	return js.Verify()
    20  }
    21  
    22  // VerifyChains verifies the signature of the signed manifest against the
    23  // certificate pool returning the list of verified chains. Signatures without
    24  // an x509 chain are not checked.
    25  func VerifyChains(sm *SignedManifest, ca *x509.CertPool) ([][]*x509.Certificate, error) {
    26  	js, err := libtrust.ParsePrettySignature(sm.all, "signatures")
    27  	if err != nil {
    28  		return nil, err
    29  	}
    30  
    31  	return js.VerifyChains(ca)
    32  }
    33  

View as plain text