func (kp kmsContextKeyHandler) decryptHandler(env Envelope) (CipherDataDecrypter, error) {
	if env.WrapAlg != KMSContextWrap {
		return nil, fmt.Errorf("%s value `%s` did not match the expected algorithm `%s` for this handler", cekAlgorithmHeader, env.WrapAlg, KMSContextWrap)
	}

	m := MaterialDescription{}
	err := m.decodeDescription([]byte(env.MatDesc))
	if err != nil {
		return nil, err
	}

	if v, ok := m[kmsAWSCEKContextKey]; !ok {
		return nil, fmt.Errorf("required key %v is missing from encryption context", kmsAWSCEKContextKey)
	} else if v == nil || *v != env.CEKAlg {
		return nil, fmt.Errorf(kmsMismatchCEKAlg)
	}

	kp.MaterialDescription = m
	kp.WrapAlgorithm = KMSContextWrap

	return &kp, nil
}
// decryptHandler initializes a KMS keyprovider with a material description. This
// is used with Decrypting kms content, due to the cmkID being in the material description.
decryptHandler initializes a KMS keyprovider with a material description. This
is used with Decrypting kms content, due to the cmkID being in the material description.
// decryptHandler initializes a KMS keyprovider with a material description . This // is used with Decrypting kms content due to the cmkID being in the material description .
func (kp kmsContextKeyHandler) decryptHandler(env Envelope) (CipherDataDecrypter, error) {
	if env.WrapAlg != KMSContextWrap {
		return nil, fmt.Errorf("%s value `%s` did not match the expected algorithm `%s` for this handler", cekAlgorithmHeader, env.WrapAlg, KMSContextWrap)
	}
	m := MaterialDescription{}
	err := m.decodeDescription([]byte(env.MatDesc))
	if err != nil {
		return nil, err
	}
	if v, ok := m[kmsAWSCEKContextKey]; !ok {
		return nil, fmt.Errorf("required key %v is missing from encryption context", kmsAWSCEKContextKey)
	} else if v == nil || *v != env.CEKAlg {
		return nil, fmt.Errorf(kmsMismatchCEKAlg)
	}
	kp.MaterialDescription = m
	kp.WrapAlgorithm = KMSContextWrap
	return &kp, nil
}
func ( kp kmsContextKeyHandler ) decryptHandler ( env Envelope ) ( CipherDataDecrypter , error ) { if env . WrapAlg != KMSContextWrap { return nil , fmt . Errorf ( " " , cekAlgorithmHeader , env . WrapAlg , KMSContextWrap ) } m := MaterialDescription { } err := m . decodeDescription ( [ ] byte ( env . MatDesc ) ) if err != nil { return nil , err } if v , ok := m [ kmsAWSCEKContextKey ] ; ! ok { return nil , fmt . Errorf ( " " , kmsAWSCEKContextKey ) } else if v == nil || * v != env . CEKAlg { return nil , fmt . Errorf ( kmsMismatchCEKAlg ) } kp . MaterialDescription = m kp . WrapAlgorithm = KMSContextWrap return & kp , nil }
decryptHandler initializes a KMS keyprovider with a material description.
decryptHandler initializes a KMS keyprovider with a material description .