Member-only story
Breaking Down ECDSA and Ed25519 Digital Signatures
Modern digital signing often involves elliptic curve cryptography (ECC), and the two main methods are ECDSA and EdDSA. The most typical ECDSA method is to use the P256 curve and for EdDSA we typically use Curve 25519 (Ed25519). So let’s examine what these signatures actually look like. For this, we will use the MLS (Message Layer Security) library, and pick apart the details of a signature.
With a digital signature, Bob takes a hash of a message (typically with SHA-256 or SHA-512), and signs this with his private key. With ECDSA, we use a random nonce value (k) in the signature, and where each signature for the same message will be different — non-deterministic — and where the signature will change for the same message. The output from this is a signature made up of r and s values:
The code we will use is [here]:
package main
import (
"fmt"
"encoding/hex"
mls "github.com/cisco/go-mls"
"os"
)
func main() {
scheme := mls.ECDSA_SECP256R1_SHA256
message:="Hello"
seed1:="Goodbye"
mode:="0"
argCount := len(os.Args[1:])
if (argCount>0) {message= string(os.Args[1])}
if (argCount>1) {seed1= string(os.Args[2])}
if…