implementing-digital-signatures-with-ed25519 skill (Anthropic-Cybersecurity-Skills)

From Public Agent Wiki

What it does. Implements digital signatures using the Ed25519 algorithm (Curve25519), covering key-pair generation, signing, signature verification, and security tradeoffs versus RSA and ECDSA. Use when adding message or artifact signing and authentication-integrity checks to a system, or when advising on Ed25519 key properties and validation criteria. Part of mukul975/Anthropic-Cybersecurity-Skills (817 security skills) (mukul975/Anthropic-Cybersecurity-Skills).

Upstream mukul975/Anthropic-Cybersecurity-Skills
Skill file skills/implementing-digital-signatures-with-ed25519/SKILL.md
License Apache-2.0 (skill folder LICENSE)
Author mukul975
Fetched 2026-09-10

Install

  • npx skills add mukul975/Anthropic-Cybersecurity-Skills --skill implementing-digital-signatures-with-ed25519, or copy the skill folder into ~/.claude/skills/implementing-digital-signatures-with-ed25519/.
  • Raw file: curl -sL https://raw.githubusercontent.com/mukul975/Anthropic-Cybersecurity-Skills/HEAD/skills/implementing-digital-signatures-with-ed25519/SKILL.md

SKILL.md (verbatim)

name: implementing-digital-signatures-with-ed25519
description: Implements digital signatures using the Ed25519 algorithm (Curve25519), covering key-pair generation, signing, signature verification, and security tradeoffs versus RSA and ECDSA. Use when adding message or artifact signing and authentication-integrity checks to a system, or when advising on Ed25519 key properties and validation criteria.
domain: cybersecurity
subdomain: cryptography
tags:
- cryptography
- digital-signatures
- ed25519
- authentication
- integrity
version: '1.0'
author: mahipal
license: Apache-2.0
nist_csf:
- PR.DS-01
- PR.DS-02
- PR.DS-10
mitre_attack:
- T1600
- T1573
- T1553

Implementing Digital Signatures with Ed25519

Overview

Ed25519 is a high-performance digital signature algorithm using the Edwards curve Curve25519. It provides 128-bit security with 64-byte signatures and 32-byte keys, offering significant advantages over RSA and ECDSA including deterministic signatures (no random nonce needed), resistance to side-channel attacks, and fast verification. This skill covers implementing Ed25519 for document signing, code signing, and API authentication.

When to Use

  • When deploying or configuring implementing digital signatures with ed25519 capabilities in your environment
  • When establishing security controls aligned to compliance requirements
  • When building or improving security architecture for this domain
  • When conducting security assessments that require this implementation

Prerequisites

  • Familiarity with cryptography concepts and tools
  • Access to a test or lab environment for safe execution
  • Python 3.8+ with required dependencies installed
  • Appropriate authorization for any testing activities

Objectives

  • Generate Ed25519 key pairs for signing
  • Sign messages and files with Ed25519
  • Verify signatures against public keys
  • Implement multi-signature verification
  • Build a simple code signing system
  • Compare Ed25519 performance with RSA and ECDSA

Key Concepts

Ed25519 vs RSA vs ECDSA

Property Ed25519 RSA-3072 ECDSA P-256
Security 128-bit 128-bit 128-bit
Public key size 32 bytes 384 bytes 64 bytes
Signature size 64 bytes 384 bytes 64 bytes
Key generation ~50 us ~100 ms ~1 ms
Sign ~70 us ~5 ms ~200 us
Verify ~200 us ~200 us ~500 us
Deterministic Yes No (PSS) No (unless RFC 6979)

Key Properties

  • Deterministic: Same message + key always produces same signature
  • Collision-resistant: No separate hash function needed
  • Side-channel resistant: Constant-time implementation
  • Small keys: 32 bytes each (public and private)

Security Considerations

  • Ed25519 does not support key recovery from signatures
  • Verify the full message, not a hash (Ed25519 hashes internally)
  • Public keys must be validated before use (check for low-order points)
  • Private keys should be stored encrypted at rest
  • Ed25519 is not yet approved for all NIST use cases (Ed448 is preferred for federal)

Validation Criteria

  • Key pair generation produces valid Ed25519 keys
  • Signature verification succeeds for valid message
  • Signature verification fails for tampered message
  • Signature verification fails for wrong public key
  • Deterministic: same input produces same signature
  • File signing and verification works correctly
  • Performance meets or exceeds RSA-3072

Other files in this skill

assets/template.md (verbatim)

Ed25519 Digital Signatures Template

Quick Reference

from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PrivateKey

# Generate
private_key = Ed25519PrivateKey.generate()
public_key = private_key.public_key()

# Sign
signature = private_key.sign(b"message data")

# Verify
public_key.verify(signature, b"message data")  # raises InvalidSignature on failure

Key Formats

Format Private Key Size Public Key Size Signature Size
Raw 32 bytes 32 bytes 64 bytes
PEM (PKCS#8) ~119 bytes ~90 bytes N/A
SSH ~83 bytes ~51 bytes ~83 bytes

Use Cases

  • API request authentication (sign request body)
  • Software/code signing
  • Document signing
  • Git commit signing (ssh-ed25519)
  • JWT signing (EdDSA algorithm)
  • Certificate signing (X.509 with Ed25519)

references/api-reference.md (verbatim)

API Reference: Ed25519 Digital Signature Agent

Dependencies

Library Version Purpose
cryptography >=41.0 Ed25519 key generation, signing, verification

CLI Usage

# Generate keypair
python scripts/agent.py --generate-keys --output-dir /keys/

# Sign a file
python scripts/agent.py --sign release.tar.gz --private-key /keys/ed25519_private.pem

# Verify files
python scripts/agent.py --verify release.tar.gz --public-key /keys/ed25519_public.pem

Functions

generate_keypair(output_dir, key_name) -> dict

Ed25519PrivateKey.generate(), serializes with private_bytes(PEM, PKCS8, NoEncryption) and public_bytes(PEM, SubjectPublicKeyInfo).

sign_message(private_key_path, message) -> dict

Loads key via load_pem_private_key(), calls key.sign(message). Returns base64 and hex signature.

sign_file(private_key_path, file_path) -> dict

Signs file contents, writes .ed25519.sig JSON containing signature, hash, timestamp.

verify_message(public_key_path, message, signature_b64) -> dict

Calls key.verify(signature, message). Catches InvalidSignature.

verify_file(public_key_path, file_path, sig_path) -> dict

Verifies file against .ed25519.sig JSON, checks hash match.

cryptography API

Method Purpose
Ed25519PrivateKey.generate() Generate 32-byte private key
private_key.sign(data) Create 64-byte signature
public_key.verify(signature, data) Verify signature
load_pem_private_key(data, password) Load PEM key

Output Schema

{
  "verifications": [{"file": "release.tar.gz", "valid": true}],
  "valid": 3, "invalid": 0
}

references/standards.md (verbatim)

Standards and References - Digital Signatures with Ed25519

Primary Standards

RFC 8032 - Edwards-Curve Digital Signature Algorithm (EdDSA)

RFC 8709 - Ed25519 and Ed448 Public Key Algorithms for SSH

NIST FIPS 186-5 - Digital Signature Standard

RFC 7748 - Elliptic Curves for Security

Python Libraries

cryptography (pyca/cryptography)

PyNaCl (libsodium)

Daniel J. Bernstein et al. - High-speed high-security signatures

references/workflows.md (verbatim)

Workflows - Digital Signatures with Ed25519

Workflow 1: Key Generation and Storage

[Generate Ed25519 Key Pair]
(32-byte private seed -> 32-byte public key)
      |
[Serialize Private Key (PKCS#8 PEM)]
[Serialize Public Key (SubjectPublicKeyInfo PEM)]
      |
[Encrypt Private Key with Passphrase]
      |
[Store with Metadata]
(key_id, fingerprint, creation_date)

Workflow 2: Sign Document

[Document to Sign]
      |
[Load Private Key (decrypt passphrase)]
      |
[Ed25519 Sign]
(deterministic: SHA-512 internal hash)
      |
[Output: 64-byte Signature]
      |
[Create Signature File]
(signature + public key reference + metadata)

Workflow 3: Verify Signature

[Document + Signature + Public Key]
      |
[Load Public Key]
      |
[Ed25519 Verify]
      |
[Valid?]
  YES -> Accept document as authentic
  NO  -> Reject (tampering detected)

Workflow 4: Code Signing System

[Build Artifact] (binary, package, container)
      |
[Hash Artifact] (SHA-256)
      |
[Create Signing Manifest]
(artifact_name, hash, timestamp, signer_id)
      |
[Sign Manifest with Ed25519]
      |
[Distribute: Artifact + Manifest + Signature + Public Key]
      |
[Recipient Verifies]:
  1. Verify signature on manifest
  2. Hash artifact and compare to manifest
  3. Check signer identity against trust store

Back to mukul975/Anthropic-Cybersecurity-Skills (817 security skills) or Agent skills.