{# canonical_base is the OWNING tenant's origin: all 16 Peasy domains serve the same catalogue, so a page rendered by a non-owner points its canonical at the owner instead of competing with it. Falls back to this site for static/self-owned pages. #}
🍋
Menu
Security

Public Key

Public Key Cryptography

A cryptographic system using paired keys where the public key encrypts and only the private key can decrypt.

Détail technique

Public Key's security rests on the computational difficulty of factoring large semiprimes. Key sizes: 2048-bit is the current minimum, 4096-bit is recommended for long-term security. RSA is ~1000x slower than AES, so it's typically used to encrypt a symmetric session key (hybrid encryption). RSA signing uses the private key; verification uses the public key — the reverse of encryption. OAEP padding (PKCS#1 v2) is required; the older PKCS#1 v1.5 padding has known vulnerabilities (Bleichenbacher's attack).

Exemple

```javascript
// AES-256-GCM encryption (Web Crypto API)
const key = await crypto.subtle.generateKey(
  { name: 'AES-GCM', length: 256 }, true, ['encrypt', 'decrypt']
);
const iv = crypto.getRandomValues(new Uint8Array(12));
const ciphertext = await crypto.subtle.encrypt(
  { name: 'AES-GCM', iv },
  key,
  new TextEncoder().encode('secret message')
);
```

Outils associés

Termes associés