예제 #1
0
파일: types.go 프로젝트: JonathanLogan/mute
// Unmarshal []byte into BlindingParamClient
func (blindingParamClient BlindingParamClient) Unmarshal(b []byte) (genericblinding.BlindingData, error) {
	n := new(BlindingParamClient)
	_, err := asn1.Unmarshal(b, n)
	if err != nil {
		return nil, err
	}
	if n.SchemeName != blindingParamClient.SchemeName {
		return nil, genericblinding.ErrBadScheme
	}
	if n.DataType != blindingParamClient.DataType {
		return nil, genericblinding.ErrBadType
	}
	if !eccutil.PointEqual(&blindingParamClient.PubKey, &n.PubKey) {
		return nil, genericblinding.ErrBadSigner
	}
	return *n, nil
}
예제 #2
0
파일: types.go 프로젝트: JonathanLogan/mute
// Unmarshal []byte into BlindingParamClient
func (clearSignature ClearSignature) Unmarshal(b []byte) (genericblinding.BlindingData, error) {
	n := new(ClearSignature)
	_, err := asn1.Unmarshal(b, n)
	if err != nil {
		return nil, err
	}
	if n.SchemeName != clearSignature.SchemeName {
		return nil, genericblinding.ErrBadScheme
	}
	if n.DataType != clearSignature.DataType {
		return nil, genericblinding.ErrBadType
	}
	if !eccutil.PointEqual(&clearSignature.PubKey, &n.PubKey) {
		return nil, genericblinding.ErrBadSigner
	}
	return *n, nil
}