identitydoc

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2016 License: MIT Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidDocument = errors.New("The provided identify document does not match the signature")

ErrInvalidDocument represents the failure when the document is not verified by the signature

View Source
var ErrUnknownRegion = errors.New("Certificate not found for the provided region")

ErrUnknownRegion indicates no certificate was found for the given region

Functions

This section is empty.

Types

type InstanceIdentityDocument

type InstanceIdentityDocument struct {
	InstanceID       string    `json:"instanceId"`
	AccountID        string    `json:"accountId"`
	PrivateIP        string    `json:"privateIp"`
	Region           string    `json:"region"`
	AvailabilityZone string    `json:"availabilityZone"`
	PendingTime      time.Time `json:"pendingTime"`
	InstanceType     string    `json:"instanceType"`
	ImageID          string    `json:"imageId"`
}

InstanceIdentityDocument represents the information contained in an instances identity document http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html

func VerifyDocumentAndSignature

func VerifyDocumentAndSignature(region string, document, signature []byte) (*InstanceIdentityDocument, error)

VerifyDocumentAndSignature will confirm that the document is correct by validating it against the signature and cert for the given region. It will return the parsed document if it's valid, or ErrInvalidDocument if it's not. Document is the data returned from: http://169.254.169.254/latest/dynamic/instance-identity/document Signature is returned from: http://169.254.169.254/latest/dynamic/instance-identity/signature If the region is unknown or has no cert, ErrUnknownRegion region will be returned. If there are any other errors, the error will be passed on.

Jump to

Keyboard shortcuts

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