// Set encryption key for the current segment of media playlist (pointer to Segment.Key)
4614
func (p *MediaPlaylist) SetKey(method, uri, iv, keyformat, keyformatversions string) error {
	if p.count == 0 {
		return errors.New("playlist is empty")
	}

	// A Media Playlist MUST indicate a EXT-X-VERSION of 5 or higher if it
	// contains:
	//   - The KEYFORMAT and KEYFORMATVERSIONS attributes of the EXT-X-KEY tag.
	if keyformat != "" || keyformatversions != "" {
		version(&p.ver, 5)
	}

	p.Segments[p.last()].Key = &Key{method, uri, iv, keyformat, keyformatversions}
	return nil
}
1109608
func (s *SessionFilter) SetKey(v string) *SessionFilter {
	s.Key = &v
	return s
}
871905
func setEncryptionMetadata(r *http.Request, bucket, object string, metadata map[string]string) (err error) {
	var (
		key []byte
	)
	if crypto.SSEC.IsRequested(r.Header) {
		key, err = ParseSSECustomerRequest(r)
		if err != nil {
			return
		}
	}
	_, err = newEncryptMetadata(key, bucket, object, metadata, crypto.S3.IsRequested(r.Header))
	return
}
972931
func (s *UpdateFlowSourceInput) SetDecryption(v *UpdateEncryption) *UpdateFlowSourceInput {
	s.Decryption = v
	return s
}
618726
func (v *Var) SetKey(value string) {
	// src := []byte(value)
	// regex := regexp.MustCompile("[0-9A-Za-z]+")
	// chunks := regex.FindAll(src, -1)
	// for i, val := range chunks {
	//
	// }
	v.Key = strings.ToUpper(value)
}
1257083
func (s *Job) SetPlaylists(v []*Playlist) *Job {
	s.Playlists = v
	return s
}
1081792
func (s *Encryption) SetKey(v string) *Encryption {
	s.Key = &v
	return s
}
643700
func (s *SetSourceRequest) SetDecryption(v *Encryption) *SetSourceRequest {
	s.Decryption = v
	return s
}
1282218
func (p *MediaPlaylist) SetSCTE35(scte35 *SCTE) error {
	if p.count == 0 {
		return errors.New("playlist is empty")
	}
	p.Segments[p.last()].SCTE = scte35
	return nil
}
1160913
func (a *ActiveDevice) setEncryptionKey(uv keybase1.UserVersion, deviceID keybase1.DeviceID, encKey GenericKey) error {
	a.Lock()
	defer a.Unlock()

	if err := a.internalUpdateUserVersionDeviceID(uv, deviceID); err != nil {
		return err
	}

	a.encryptionKey = encKey
	return nil
}
403913
func (s *CertificateAuthorityConfiguration) SetKeyAlgorithm(v string) *CertificateAuthorityConfiguration {
	s.KeyAlgorithm = &v
	return s
}
443422
func (s *CreateJobInput) SetPlaylists(v []*CreateJobPlaylist) *CreateJobInput {
	s.Playlists = v
	return s
}
923786
func (s *Record) SetPartitionKey(v string) *Record {
	s.PartitionKey = &v
	return s
}
829844
func (kp *kmsKeyHandler) DecryptKey(key []byte) ([]byte, error) {
	out, err := kp.kms.Decrypt(&kms.DecryptInput{
		EncryptionContext: map[string]*string(kp.CipherData.MaterialDescription),
		CiphertextBlob:    key,
		GrantTokens:       []*string{},
	})
	if err != nil {
		return nil, err
	}
	return out.Plaintext, nil
}
579238
func (s *HlsManifest) SetPlaylistType(v string) *HlsManifest {
	s.PlaylistType = &v
	return s
}
870710
func (o *Metadata) SetKey(v *string) *Metadata {
	if o.Key = v; o.Key == nil {
		o.nullFields = append(o.nullFields, "Key")
	}
	return o
}
847148
func (s *PutRecordOutput) SetEncrypted(v bool) *PutRecordOutput {
	s.Encrypted = &v
	return s
}