360 Secure SkillHub
360 安全技能中心

Agent Identity

基于 cryptography 库的 Python 命令行 Skill:为 AI Agent 生成 Ed25519/RSA 密钥对、对消息签名与验签、由公钥派生 Agent ID,并生成签名 Agent Card。密钥以 PEM 文件保存到本地 keys/ 目录,全程本地运算;文档另称有 PowerShell 包装脚本,但本版本文件列表中只有 identity.py。

nantes
nantes
热度 64.39
最近更新 2026-05-11 17:26:48
分类:安全依赖:代码执行 / 读写文件应用场景:自动化脚本 / API 集成

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add agent-id-osiris
Metadata
name
agent-identity
version
1.0.3
description
Cryptographic identity for AI agents - sign and verify agent messages
metadata
{"openclaw":{"emoji":"🆔","category":"security","requires":{"bins":["python"],"pip":["cryptography"]},"homepage":"https://github.com"}}

Agent Identity Skill

Cryptographic identity system for AI agents. Sign messages, verify agents, prove who you are.

Files included:

  • identity.py - Python CLI (cross-platform)
  • agent-identity.ps1 - PowerShell wrapper (Windows)

What it does

  • Generate Key Pair - Create Ed25519 or RSA keys for your agent
  • Sign Messages - Cryptographically sign messages
  • Verify Signatures - Verify messages from other agents
  • Agent ID - Generate persistent agent ID from public key
  • Agent Card - Generate signed Agent Card for A2A/MCP

Installation

# Install Python dependency
pip install cryptography

Usage

Option 1: PowerShell (recommended on Windows)

.\agent-identity.ps1 -Action generate -AgentName "MyAgent" -KeyType ed25519 -Password "secret123"

Option 2: Python CLI (cross-platform)

python identity.py generate --name MyAgent --key-type ed25519 --password secret123

Available Commands

All commands work with both PowerShell and Python:

Generate Identity (with password encryption)

.\agent-identity.ps1 -Action generate -AgentName "MyAgent" -KeyType ed25519 -Password "secret123"

Sign Message

.\agent-identity.ps1 -Action sign -Message "Hello world" -PrivateKeyPath "keys/private.pem" -Password "secret123"

Verify Signature

.\agent-identity.ps1 -Action verify -Message "Hello world" -Signature "base64-signature" -PublicKeyPath "keys/public.pem"

Get Agent ID

.\agent-identity.ps1 -Action id -PublicKeyPath "keys/public.pem"

Sign Agent Card

.\agent-identity.ps1 -Action card -PublicKeyPath "keys/public.pem" -PrivateKeyPath "keys/private.pem" -Name "MyAgent" -Description "Research agent" -Capabilities "research,analysis" -Endpoint "https://myagent.com/a2a" -Password "secret123"

⚠️ Security Warnings

Password on Command Line

WARNING: Passing passwords on the command line is insecure because:

  • CLI arguments can be visible to other processes
  • Command history is stored in logs
  • Use only for testing, not production

For production, use interactive password input or environment variables.

Private Key Storage

  • Keys are stored in keys/ directory
  • Ensure proper file permissions
  • Back up your keys securely
  • Never share your private key

Requirements

  • Python 3.8+
  • cryptography library

License

MIT