예제 #1
0
func (sig *JSONSignature) UnmarshalJSON(data []byte) error {
	sig.Signature = nil
	if s, err := jose.ParseSigned(string(data)); nil != err {
		return err
	} else {
		sig.Signature = s
		return nil
	}
}
예제 #2
0
func (skey SigningKey) Verify(signature string, payload *[]byte, nonce *string) error {
	if sig, err := jose.ParseSigned(signature); nil != err {
		return err
	} else if sigPayload, sigHeader, err := sig.Verify(skey.GetPublicKey()); nil != err {
		return err
	} else {
		if nil != nonce {
			*nonce = sigHeader.Nonce
		}
		if nil != payload {
			*payload = sigPayload
		}
		return nil
	}
}