// CreateReply creates MessageReply. func CreateReply( UIDMessageEncrypted, HCEntry string, HCPos uint64, sigKey *cipher.Ed25519Key, ) *MessageReply { // Construct Entry from hcEntry, hcPos, UIDMessageEncrypted entry := Entry{ UIDMESSAGEENCRYPTED: UIDMessageEncrypted, HASHCHAINENTRY: HCEntry, HASHCHAINPOS: HCPos, } // Sign Entry by Key Server's key pkey: serverSig = sign(pkey, Entry) serverSig := sigKey.Sign(entry.json()) // Construct MessageReply from Entry, serverSig return &MessageReply{ ENTRY: entry, SERVERSIGNATURE: base64.Encode(serverSig), } }
// Sign signs the KeyInit message and returns the signature. func (ki *KeyInit) Sign(sigKey *cipher.Ed25519Key) string { return base64.Encode(sigKey.Sign(ki.JSON())) }