v0.0.0-...-361643f Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Jan 23, 2017 License: Apache-2.0 Imports: 4 Imported by: 0




View Source
const (
	// DockerV2Schema1MediaType MIME type represents Docker manifest schema 1
	DockerV2Schema1MediaType = "application/vnd.docker.distribution.manifest.v1+json"
	// DockerV2Schema1MediaType MIME type represents Docker manifest schema 1 with a JWS signature
	DockerV2Schema1SignedMediaType = "application/vnd.docker.distribution.manifest.v1+prettyjws"
	// DockerV2Schema2MediaType MIME type represents Docker manifest schema 2
	DockerV2Schema2MediaType = "application/vnd.docker.distribution.manifest.v2+json"
	// DockerV2Schema2ConfigMediaType is the MIME type used for schema 2 config blobs.
	DockerV2Schema2ConfigMediaType = "application/vnd.docker.container.image.v1+json"
	// DockerV2Schema2LayerMediaType is the MIME type used for schema 2 layers.
	DockerV2Schema2LayerMediaType = "application/vnd.docker.image.rootfs.diff.tar.gzip"
	// DockerV2ListMediaType MIME type represents Docker manifest schema 2 list
	DockerV2ListMediaType = "application/vnd.docker.distribution.manifest.list.v2+json"
	// DockerV2Schema2ForeignLayerMediaType is the MIME type used for schema 2 foreign layers.
	DockerV2Schema2ForeignLayerMediaType = "application/vnd.docker.image.rootfs.foreign.diff.tar.gzip"

FIXME(runcom, mitr): should we havea mediatype pkg??


DefaultRequestedManifestMIMETypes is a list of MIME types a types.ImageSource should request from the backend unless directed otherwise.


func AddDummyV2S1Signature

func AddDummyV2S1Signature(manifest []byte) ([]byte, error)

AddDummyV2S1Signature adds an JWS signature with a temporary key (i.e. useless) to a v2s1 manifest. This is useful to make the manifest acceptable to a Docker Registry (even though nothing needs or wants the JWS signature).

func Digest

func Digest(manifest []byte) (digest.Digest, error)

Digest returns the a digest of a docker manifest, with any necessary implied transformations like stripping v1s1 signatures.

func GuessMIMEType

func GuessMIMEType(manifest []byte) string

GuessMIMEType guesses MIME type of a manifest and returns it _if it is recognized_, or "" if unknown or unrecognized. FIXME? We should, in general, prefer out-of-band MIME type instead of blindly parsing the manifest, but we may not have such metadata available (e.g. when the manifest is a local file).

func MatchesDigest

func MatchesDigest(manifest []byte, expectedDigest digest.Digest) (bool, error)

MatchesDigest returns true iff the manifest matches expectedDigest. Error may be set if this returns false. Note that this is not doing ConstantTimeCompare; by the time we get here, the cryptographic signature must already have been verified, or we are not using a cryptographic channel and the attacker can modify the digest along with the manifest blob.


This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL