INNER CODE UNIT · Go
sign
aead/minisign · minisign.go:164
func sign(privateKey PrivateKey, message []byte, trustedComment, untrustedComment string, isHashed bool) []byte {
algorithm := EdDSA
if isHashed {
algorithm = HashEdDSA
}
var (
msgSignature = ed25519.Sign(ed25519.PrivateKey(privateKey.bytes[:]), message)
commentSignature = ed25519.Sign(ed25519.PrivateKey(privateKey.bytes[:]), append(msgSignature, []byte(trustedComment)...))
)
signature := Signature{
Algorithm: algorithm,
KeyID: privateKey.ID(),
TrustedComment: trustedComment,
UntrustedComment: untrustedComment,
}
copy(signature.Signature[:], msgSignature)