加密数字签名的内容是否有标准格式?

Is there a standard format for what to encrypt as a digital signature?

发送使用非对称加密的消息时,例如

Long long, very long message here. // encrypted with recipents public key

Signed by John Doe // encrypted with own private key

想和自己的数字签名保持一致吗?签名部分是否有标准格式或广泛使用的约定?或者甚至,是否有任何约定,或者每个人想要放在那里的东西完全是随机的?

编辑:

我想我的问题并不是关于标准本身的。更确切地说,如果人们会在即时通讯程序或电子邮件中发送示例格式的消息,那么关于约定。

首先 - 用户使用其私钥签名,而不是加密..

现在进入主题:

有几种协议可以传递加密和签名的数据。

如果您正在使用(网络)服务,您可以查看 WS-Security 或 XML signature

如果您正在寻找更通用的标准,您可以搜索 "CMS Cryptographic Message Syntax" 或 PKCS#7

还有一些特定于工具的协议,例如使用 openssl、文档内签名(pdf、word、..)……它们本身不是标准,但很常用。

您在 中提到:

First - the users signs with its private key, not encrypts.. Yes, but doesn't the signing mean encrypting a signature with your private key (so that anyone can check it with your public key), like in my example?

虽然这个评论的答案一般是:没有

加密签名可以通过多种不同的方式构建。在RSA中,签名操作类似于加密的一些元素,但这是巧合。

以椭圆曲线的Schnorr签名方案为例:

(In this example, G is a base point for some secure elliptic curve E.
 All variables between brackets are scalars modulo the order of E.)


Setup:
  Alice has a private key x (random).
  Bob has Alice's public key P_A = [x]G.

Alice signs a message m:
  k := random()
  Q := [k]G
  c := H(Q||P_A||m)
  r := k + c*x
  Alice outputs s := (Q, r)

Bob verifies s over m:
  c := H(Q||P_A||m)
  Check if [r]G == Q + [c]P_A

如您所见,这里没有 "encryption" 的真正概念。它只是一个协议。