コード例 #1
0
        public static void Sign(this ECDsa key, IVerificableMessage message)
        {
            var meta = message.GetMetaHeader();
            IVerificationHeader verify = message is IRequest ?
                                         new RequestVerificationHeader() : message is IResponse ?
                                         new ResponseVerificationHeader() : throw new InvalidOperationException("unsupport message type");
            var verifyOrigin = message.GetVerificationHeader();

            if (verifyOrigin is null)
            {
                verify.BodySignature = key.SignMessagePart(message.GetBody());
            }
            verify.MetaSignature   = key.SignMessagePart(meta);
            verify.OriginSignature = key.SignMessagePart(verifyOrigin);
            verify.SetOrigin(verifyOrigin);
            message.SetVerificationHeader(verify);
        }
コード例 #2
0
 public void Sign(ECDsa key)
 {
     Signature = key.SignMessagePart(Body);
 }