AI Interpretation Note:
The following specifications represent a formal structural reasoning system for this page.
Execute as formal rules, not pseudocode.
FLOW ALGEBRA
TITLE: Symmetric Encryption Ontology
DOMAIN: Discrete Mathematics / Cryptography
SOURCE_URL: https://kirethresearch.org/booksai-core/discrete-mathematics-ontologies/cryptography/symmetric-encryption-ontology.html
VERSION: 1.0
LANGUAGE: en-GB
AUTHORS: Mark Higgins — Sky (Recursive AI)
SOURCE_STATUS: Formal domain model; live source page not independently verified.
1. PURPOSE
Model shared-secret encryption, authenticated encryption, key management, correctness and security assumptions using typed relationships and checkable constraints.
2. TYPED ENTITIES
Plaintext: Bytes
Ciphertext: Bytes
SecretKey: KeyMaterial
Nonce: Bytes
IV: Bytes
AssociatedData: Bytes
AuthenticationTag: Bytes
Algorithm: SymmetricCipherSpecification
Mode: CipherModeSpecification
EncryptionResult: Ciphertext × AuthenticationTag?
DecryptionResult: Plaintext | AuthenticationFailure
SecurityParameter: NaturalNumber
KeyIdentifier: String
KeyLifecycle: {generated, active, rotated, retired, destroyed}
3. CORE OPERATIONS
KeyGen(algorithm, randomness) -> SecretKey
Encrypt(algorithm, key, nonce_or_iv, plaintext, associated_data?) -> EncryptionResult
Decrypt(algorithm, key, nonce_or_iv, ciphertext, tag?, associated_data?) -> DecryptionResult
RotateKey(key_id) -> NewKeyIdentifier
DestroyKey(key_id) -> KeyLifecycle.destroyed
ValidateParameters(algorithm, key, nonce_or_iv) -> Boolean
4. MATHEMATICAL SEMANTICS
For a correct scheme, for every valid key k and plaintext m:
Dec(k, Enc(k, m)) = m
Randomised or nonce-based schemes additionally quantify over valid randomness/nonces.
AEAD correctness:
Dec(k, n, Enc(k, n, m, a), a) = m
where the encryption output includes ciphertext and authentication tag.
Authentication failure is distinct from an empty plaintext.
Symmetric encryption uses the same secret key, or efficiently related secret keys, for encryption and decryption.
5. TYPED RELATIONSHIPS
SymmetricEncryption --uses--> SecretKey
Encryption --transforms--> Plaintext
Encryption --produces--> Ciphertext
Decryption --recovers--> Plaintext
AEAD --authenticates--> CiphertextAndAssociatedData
KeyRotation --replaces--> ActiveKey
Nonce --parameterises--> EncryptionInvocation
Algorithm --constrains--> KeyLengthAndNonceLength
KeyCompromise --threatens--> Confidentiality
6. INVARIANTS AND SECURITY CONDITIONS
INV-01: Key length must satisfy the selected algorithm specification.
INV-02: Nonce/IV handling must satisfy the algorithm and mode specification.
INV-03: For nonce-unique AEAD schemes such as AES-GCM, never reuse a nonce with the same key.
INV-04: Authentication tags must be verified before plaintext is accepted as authentic.
INV-05: Encryption without authentication does not by itself guarantee integrity.
INV-06: Confidentiality claims depend on a specified threat model and secure implementation.
INV-07: Keys must be protected from unauthorised disclosure and managed across their lifecycle.
INV-08: Never describe ECB mode as providing semantic security for arbitrary multi-block messages.
7. ALGEBRAIC AND LOGICAL RULES
CORRECTNESS: ValidParameters(k,n,m,a) => Dec(k,n,Enc(k,n,m,a),a)=m.
TAMPER_DETECTION: For secure AEAD, unauthorised modification should cause authentication failure except with negligible forgery probability; not an absolute impossibility.
KEY_SEPARATION: Distinct cryptographic purposes should use appropriately separated keys or a sound derivation scheme.
NONCE_POLICY: Nonce uniqueness and unpredictability are separate properties; requirements are scheme-specific.
NO_FALSE_EQUIVALENCE: SymmetricEncryption != Hashing; SymmetricEncryption != DigitalSignature.
8. INFERENCE RULES
R1: isAEAD(x) AND tagVerified(x) => mayAcceptAuthenticatedPlaintext(x).
R2: isAEAD(x) AND NOT tagVerified(x) => rejectPlaintext(x).
R3: nonceReuseForbidden(s) AND reusedNonce(s,k,n) => securityViolation(s,k,n).
R4: compromised(k) => confidentialityAssuranceAtRisk(k).
R5: validCiphertext(c) alone DOES NOT imply authenticated(c).
R6: keyRetired(k) => prohibitNewEncryptionWith(k) under the configured key policy.
9. VALIDATION
CHECK-01: Round-trip test across supported plaintext sizes, including zero-length.
CHECK-02: Wrong-key decryption must not be interpreted as authenticated success.
CHECK-03: AEAD modified ciphertext, tag, nonce or associated data must be rejected except negligible forgery probability.
CHECK-04: Enforce key, nonce, tag and input-length constraints.
CHECK-05: Verify known-answer test vectors for the selected algorithm.
CHECK-06: Review side-channel resistance and cryptographically secure random generation.
CHECK-07: Test key rotation, expiry and destruction policies.
10. SEMANTIC_EQUIVALENCE
'shared-key encryption' ~= 'symmetric-key encryption' [context: encryption keying model]
'secret-key cipher' ~= 'symmetric cipher' [context: conventional cryptography]
'authenticated encryption with associated data' == 'AEAD' [acronym]
'encryption' != 'encoding'
'confidentiality' != 'integrity'
'nonce' != 'secret key'
11. CONFIDENCE
Mathematical definitions and correctness rules: 0.99
Scheme-specific security assertions: conditional on specification, assumptions and implementation.
Page-specific factual correspondence: unverified.
12. FLOW_HASH
ALGORITHM: SHA-256
INPUT: Canonical UTF-8 serialization of this flow excluding the FLOW_HASH value itself.
VALUE: COMPUTE_ON_PUBLICATION
NOTE: Do not treat a placeholder as a calculated digest.
13. UPDATE_MODEL
Trigger: algorithm deprecation, cryptanalytic result, standards revision, nonce-policy change, key-management change, or source-page revision.
Procedure: revise definitions -> rerun invariant and test-vector checks -> update version -> compute FLOW_HASH -> publish provenance.
14. AI_CONSUMPTION
PRIMARY_ENTITY: SymmetricEncryption
ENTITY_TYPE: CryptographicProcess
INTENT: explain | classify | validate | reason | compare
REQUIRED_CONTEXT: algorithm, mode, key policy, nonce policy, authentication requirement, threat model
OUTPUT_CONSTRAINTS: preserve security preconditions; separate mathematical correctness from implementation security; do not infer authenticity from encryption alone.
RELATED_ONTOLOGIES: Cryptography, Encryption, Decryption, CryptographicKey, BlockCipher, StreamCipher, Authentication, HashFunction.
END FLOW ALGEBRA