| 1 |
// Package keypair provides cryptographic key pair management for multiple algorithms. |
| 2 |
// |
| 3 |
// It supports key generation, parsing, formatting, and manipulation for: |
| 4 |
// - RSA: Supports PKCS1 and PKCS8 key formats, with configurable padding schemes |
| 5 |
// - SM2: Supports PKCS8/PKIX formats with configurable ciphertext order |
| 6 |
// - Ed25519: Supports PKCS8 format |
| 7 |
// |
| 8 |
// Each key pair type provides methods for: |
| 9 |
// - Generating new key pairs |
| 10 |
// - Parsing keys from PEM format |
| 11 |
// - Formatting keys to PEM format |
| 12 |
// - Setting algorithm-specific parameters |
| 13 |
package keypair |
| 14 |
|
| 15 |
// KeyType represents the type of cryptographic key (public or private). |
| 16 |
// This is used to distinguish between public key and private key |
| 17 |
// in key pair operations and management. |
| 18 |
type KeyType string |
| 19 |
|
| 20 |
const ( |
| 21 |
PublicKey KeyType = "publicKey" |
| 22 |
PrivateKey KeyType = "privateKey" |
| 23 |
) |