Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
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
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"` Doc json.RawMessage `json:"-"` Sig []byte `json:"-"` }
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.
func (InstanceIdentityDocument) CheckSignature ¶ added in v1.4.0
func (d InstanceIdentityDocument) CheckSignature() error