Security Model
This document outlines the security architecture, threat model, and best practices for the Network-Agnostic Secure Payment Instruction Protocol (NASPIP).
Security Architecture
Cryptographic Foundation
NASPIP is built on PASETO v4 public tokens with Ed25519 keys:
PASETO v4 Public Tokens
- Signing: Ed25519 via PASETO v4 (
v4.public.*) - Payload encoding: Protobuf (not raw JSON)
- Claims: Standard PASETO claims plus NASPIP-specific
kis,kid,kep - Purpose: Integrity and authenticity of payment instructions (not confidentiality — public tokens are verifiable by anyone with the public key)
Key identification
kis(key issuer): Identifies the key-issuing entity (e.g.fluxis.us)kid(key ID): Selects the specific signing key for verificationkep(key expiration): When the signing key itself expires
Key Management
Key Generation
Code
Key Storage Best Practices
- Hardware Security Modules (HSM): Store private keys in dedicated hardware
- Key Derivation: Use PBKDF2 or Argon2 for key derivation from passwords
- Key Rotation: Implement regular key rotation procedures
- Access Control: Limit access to private keys to authorized personnel only
Threat Model
Attack Vectors
NASPIP is designed to protect against the following attack vectors:
1. Data Tampering
Threat: Malicious modification of payment instructions Protection: Digital signatures ensure data integrity Mitigation:
- All payment instructions are cryptographically signed
- PASETO v4 signature verification prevents unauthorized modifications
- Protobuf payload encoding prevents signature bypass via JSON reordering
2. Replay Attacks
Threat: Reusing valid payment instructions multiple times Protection: Unique identifiers and expiration times Mitigation:
- Each payment instruction has a unique ID
- Expiration times prevent indefinite reuse
- Server-side validation of payment status
3. Man-in-the-Middle (MITM) Attacks
Threat: Interception and modification of payment data in transit Protection: Cryptographic signatures on every token (PASETO v4) Mitigation:
- Payment instructions are signed at issuance with the issuer's private key
- Wallets verify signatures using the issuer's public key (
kis+kidlookup) - TLS protects transport; signature verification protects payload integrity independent of TLS
4. Impersonation Attacks
Threat: Malicious actors pretending to be legitimate payment providers Protection: Public key verification Mitigation:
- Public keys are used to verify signature authenticity
- Key fingerprint verification
- Certificate pinning for known entities
5. Brute Force Attacks
Threat: Attempting to guess private keys or signatures Protection: Cryptographically secure key generation Mitigation:
- 256-bit Ed25519 keys provide 128-bit security
- Secure random number generation
- Rate limiting on verification attempts
Security Assumptions
NASPIP's security relies on the following assumptions:
- Cryptographic Primitives: PASETO v4 and Ed25519 are secure
- Random Number Generation: Cryptographically secure RNG is available
- Key Management: Private keys are kept secure by the issuer
- Network Transport: Transport layer security (TLS) for data in transit
- Implementation: Correct use of naspip-go or Fluxis API for sign/verify
Security Features
1. Data Integrity
Every payment instruction is wrapped in a PASETO v4 public token to ensure it hasn't been tampered with:
Code
2. Authentication
PASETO v4 signatures provide proof of origin. Verifiers resolve the issuer's public key using kis and kid from the token string, then validate the PASETO signature and expiration claims. Fluxis performs this automatically in POST /v1/naspip/read.
3. Non-repudiation
Payment instructions cannot be denied by the signer:
- Digital signatures provide mathematical proof of origin
- Signatures are tied to specific private keys
- Audit trails can be maintained
4. Expiration and Timeouts
Payment instruction tokens include PASETO exp claims (default 1 hour). Instruction payloads may also set payment.expires_at:
Code
5. Unique Identifiers
Each payment instruction has a unique identifier to prevent replay attacks:
Code
6. URL Payload Trust Boundary (Fluxis)
URL payloads defer payment details to an HTTPS endpoint. When Fluxis resolves a URL during POST /v1/naspip/read:
- The NASPIP token signature is verified before the URL fetch
- The fetched response replaces
payload.data— callers must treat resolved data with the same validation as direct instruction payloads - URL endpoints must be trusted Fluxis checkout URLs; arbitrary URLs are rejected on fetch failure
Security Best Practices
For Implementers
1. Key Management
Code
2. Input Validation
Code
3. Error Handling
Code
4. Secure Random Generation
Code
For Users
1. Public Key Verification
- Always verify the public key of payment providers
- Use certificate pinning for known entities
- Check key fingerprints against trusted sources
2. Expiration Validation
- Always check expiration times before processing payments
- Reject expired payment instructions
- Implement reasonable expiration policies
3. Amount Validation
- Validate payment amounts on both sender and receiver sides
- Implement minimum and maximum amount limits
- Check for reasonable payment ranges
Security Auditing
Code Review Checklist
When reviewing NASPIP implementations, ensure:
- Cryptographically secure random number generation
- Proper key management and storage
- Input validation and sanitization
- Secure error handling
- No sensitive data in logs
- Proper signature verification
- Expiration time validation
- Unique identifier generation
Security Testing
Automated Testing
Code
Penetration Testing
- Test for signature bypass vulnerabilities
- Attempt replay attacks
- Test key management security
- Validate input sanitization
- Test error handling for information disclosure
Compliance and Standards
Cryptographic Standards
- Ed25519: RFC 8032
- SHA-256: FIPS 180-4
- Random Number Generation: NIST SP 800-90A
Security Frameworks
- OWASP Top 10: Addresses common web application vulnerabilities
- NIST Cybersecurity Framework: Risk management approach
- ISO 27001: Information security management
Incident Response
Security Incident Types
- Key Compromise: Private key exposure
- Signature Bypass: Circumvention of signature verification
- Replay Attack: Successful reuse of payment instructions
- Implementation Vulnerability: Bugs in cryptographic operations
Response Procedures
-
Immediate Actions:
- Revoke compromised keys
- Generate new key pairs
- Update public key registries
- Notify affected parties
-
Investigation:
- Analyze attack vectors
- Review logs and audit trails
- Identify root causes
- Assess impact scope
-
Recovery:
- Implement security patches
- Update security procedures
- Conduct security training
- Monitor for similar attacks
Future Security Considerations
Post-Quantum Cryptography
As quantum computing advances, NASPIP may need to transition to quantum-resistant algorithms:
- Lattice-based cryptography: NTRU, LWE
- Hash-based signatures: SPHINCS+
- Code-based cryptography: McEliece
Advanced Security Features
- Multi-signature support: Require multiple signatures for high-value payments
- Threshold signatures: Distributed key generation and signing
- Zero-knowledge proofs: Privacy-preserving payment verification
- Hardware security: TPM/HSM integration
Resources
- Protocol Specification
- Implementation Guide
- OWASP Cryptographic Storage Cheat Sheet
- NIST Cryptographic Standards
- RFC 8032 - Ed25519