// UnmarshalHeaders loads the current state of the DEKs into a new RaftDEKData object (which is returned) given the
// current TLS headers and the current KEK.
545148
func (r RaftDEKData) UnmarshalHeaders(headers map[string]string, kekData ca.KEKData) (ca.PEMKeyHeaders, error) {
	var (
		currentDEK, pendingDEK []byte
		err                    error
	)

	if currentDEKStr, ok := headers[pemHeaderRaftDEK]; ok {
		currentDEK, err = decodePEMHeaderValue(currentDEKStr, kekData.KEK, r.FIPS)
		if err != nil {
			return nil, err
		}
	}
	if pendingDEKStr, ok := headers[pemHeaderRaftPendingDEK]; ok {
		pendingDEK, err = decodePEMHeaderValue(pendingDEKStr, kekData.KEK, r.FIPS)
		if err != nil {
			return nil, err
		}
	}

	if pendingDEK != nil && currentDEK == nil {
		return nil, fmt.Errorf("there is a pending DEK, but no current DEK")
	}

	_, ok := headers[pemHeaderRaftDEKNeedsRotation]
	return RaftDEKData{
		NeedsRotation: ok,
		EncryptionKeys: raft.EncryptionKeys{
			CurrentDEK: currentDEK,
			PendingDEK: pendingDEK,
		},
		FIPS: r.FIPS,
	}, nil
}
1034571
func (s *TestInvokeAuthorizerInput) SetHeaders(v map[string]*string) *TestInvokeAuthorizerInput {
	s.Headers = v
	return s
}
551857
func unmarshal(in []byte, out interface{}) error {
	trailing, err := asn1.Unmarshal(in, out)
	if err != nil {
		return err
	}
	if len(trailing) != 0 {
		return errors.New("pkcs12: trailing data found")
	}
	return nil
}
1307787
func (ps *PeerRoundState) Unmarshal(bs []byte) error {
	return cdc.UnmarshalBinaryBare(bs, ps)
}
888927
func (jsonMarshalerUnmarshaler) Unmarshal(data []byte, v interface{}) error {
	return json.Unmarshal(data, v)
}
304336
func UnmarshalWithoutHeaders(in io.Reader, out interface{}) error {
	return readToWithoutHeaders(newDecoder(in), out)
}
1280271
func (gobMarshalerUnmarshaler) Unmarshal(data []byte, v interface{}) error {
	buff := bytes.NewBuffer(data)
	dec := gob.NewDecoder(buff)
	if err := dec.Decode(v); err != nil {
		return err
	}
	return nil
}
154573
func (s *ForwardedValues) SetHeaders(v *Headers) *ForwardedValues {
	s.Headers = v
	return s
}
683561
func (G *global_data) SetHeaders(headers map[string]string) *global_data {
	if G.Req.Headers == nil {
		G.Req.Headers = make(map[string]string)
	}
	for key, value := range headers {
		G.Req.Headers[key] = value
	}
	return G
}
598987
func (prefix *DevAddrPrefix) Unmarshal(data []byte) error {
	prefix.DevAddr = [4]byte{} // Reset the receiver
	prefix.Length = 0
	return prefix.UnmarshalBinary(data)
}
1248948
func (h *Headers) UnmarshalJSON(data []byte) error {
	if h == nil {
		return errors.New("network.Headers: UnmarshalJSON on nil pointer")
	}
	*h = append((*h)[0:0], data...)
	return nil
}
1202316
func (bh *Header) UnmarshalBinary(b []byte) error {
	return bh.DecodeBinary(bytes.NewReader(b))
}
1140926
func (s *ContextDataType) SetHttpHeaders(v []*HttpHeader) *ContextDataType {
	s.HttpHeaders = v
	return s
}
1356241
func (that *JSONNode) UnmarshalJSON(data []byte) error {
	if len(data) == 0 {
		return nil
	}
	if that.dontExpand && that.t == TypeUndefined {
		return nil
	}
	if that.t == TypeValue {
		return that.unmarshalValue(data)
	}
	if data[0] == '{' {
		if that.t != TypeMap && that.t != TypeUndefined {
			return ErrorTypeUnmarshaling
		}
		return that.unmarshalMap(data)
	}
	if data[0] == '[' {
		if that.t != TypeArray && that.t != TypeUndefined {
			return ErrorTypeUnmarshaling
		}
		return that.unmarshalArray(data)

	}
	if that.t == TypeUndefined {
		return that.unmarshalValue(data)
	}
	return ErrorTypeUnmarshaling
}
523743
func unmarshal(packet []byte) (interface{}, error) {
	if len(packet) < 1 {
		return nil, errors.New("agent: empty packet")
	}
	var msg interface{}
	switch packet[0] {
	case agentFailure:
		return new(failureAgentMsg), nil
	case agentSuccess:
		return new(successAgentMsg), nil
	case agentIdentitiesAnswer:
		msg = new(identitiesAnswerAgentMsg)
	case agentSignResponse:
		msg = new(signResponseAgentMsg)
	default:
		return nil, fmt.Errorf("agent: unknown type tag %d", packet[0])
	}
	if err := ssh.Unmarshal(packet, msg); err != nil {
		return nil, err
	}
	return msg, nil
}
1336749
func (c *DataContainer) UnmarshalJSON(payload []byte) error {
	if bytes.HasPrefix(payload, objectSuffix) {
		return json.Unmarshal(payload, &c.DataObject)
	}

	if bytes.HasPrefix(payload, arraySuffix) {
		return json.Unmarshal(payload, &c.DataArray)
	}

	return errors.New("expected a JSON encoded object or array")
}
134716
func (bm *BlockMeta) Unmarshal(bs []byte) error {
	return cdc.UnmarshalBinaryBare(bs, bm)
}