FLOW ALGEBRA
TITLE: Cryptography Ontology
DOMAIN: Discrete Mathematics > Cryptography
SOURCE_URL: https://kirethresearch.org/booksai-core/discrete-mathematics-ontologies/cryptography/cryptography-ontology-2.html
VERSION: 1.0
DATE: 2026-10-11
AUTHORS: Mark Higgins — Sky (Recursive AI)
SITE: https://kirethresearch.org
STATUS: Formal conceptual model; source page not independently verified.
1. PURPOSE
Model cryptographic primitives, protocols, keys, messages, security properties, adversaries and proof obligations as typed relationships and constrained operations. Distinguish mathematical correctness from security under explicit threat models.
2. TYPED ENTITIES
Message := finite byte string or typed plaintext
Ciphertext := finite byte string with scheme-specific structure
Key := secret or public cryptographic key with algorithm and usage metadata
SecretKey <: Key
PublicKey <: Key
PrivateKey <: SecretKey
Nonce := scheme-specific unique or random input
Randomness := sampled value from a specified distribution
Algorithm := defined cryptographic transformation
EncryptionScheme := (KeyGen, Encrypt, Decrypt)
SignatureScheme := (KeyGen, Sign, Verify)
HashFunction := bytes -> fixed-length digest
MACScheme := (KeyGen, Tag, VerifyTag)
KDF := key derivation function with context and parameters
Protocol := ordered interactions with participant roles
Adversary := actor with explicitly stated capabilities
SecurityProperty := confidentiality | integrity | authenticity | nonrepudiation | availability
SecurityAssumption := computational or operational hypothesis
SecurityClaim := property + threat model + assumptions + scope
ProofArtifact := formal derivation, reduction, or tested evidence
3. CORE RELATIONSHIPS
USES(Protocol, Algorithm)
GENERATES(KeyGen, Key)
ENCRYPTS(EncryptionScheme, Message, Ciphertext)
DECRYPTS(EncryptionScheme, Ciphertext, Message)
SIGNS(PrivateKey, Message, Signature)
VERIFIES(PublicKey, Message, Signature, Boolean)
DERIVES(KDF, InputKeyMaterial, DerivedKey)
AUTHENTICATES(Protocol, Participant)
DEPENDS_ON(SecurityClaim, SecurityAssumption)
THREATENED_BY(SecurityProperty, Adversary)
VALIDATED_BY(SecurityClaim, ProofArtifact)
4. OPERATIONS AND TYPE SIGNATURES
SymmetricKeyGen(params) -> SecretKey
SymEncrypt(k: SecretKey, n: Nonce, m: Message, aad: bytes) -> Ciphertext
SymDecrypt(k: SecretKey, n: Nonce, c: Ciphertext, aad: bytes) -> Message | FAIL
AsymmetricKeyGen(params) -> (PublicKey, PrivateKey)
PkEncrypt(pk: PublicKey, m: Message, randomness: Randomness) -> Ciphertext
PkDecrypt(sk: PrivateKey, c: Ciphertext) -> Message | FAIL
Sign(sk: PrivateKey, m: Message) -> Signature
Verify(pk: PublicKey, m: Message, sig: Signature) -> Boolean
Hash(m: bytes) -> Digest
Tag(k: SecretKey, m: Message) -> TagValue
VerifyTag(k: SecretKey, m: Message, tag: TagValue) -> Boolean
Derive(ikm: bytes, salt: bytes, context: bytes) -> DerivedKey
5. CORRECTNESS AXIOMS
For honestly generated matching encryption keys and valid inputs:
Decrypt(sk, Encrypt(pk, m; r)) = m
For valid authenticated encryption inputs:
SymDecrypt(k, n, SymEncrypt(k, n, m, aad), aad) = m
For honestly generated signing keys:
Verify(pk, m, Sign(sk, m)) = TRUE
For invalid ciphertexts or authentication tags, authenticated decryption returns FAIL.
Correctness alone DOES NOT imply secrecy, unforgeability or resistance to attacks.
6. SECURITY CONSTRAINTS
CONFIDENTIALITY: specify adversary access, leakage and chosen-plaintext/chosen-ciphertext model (e.g. IND-CPA, IND-CCA).
INTEGRITY: specify forgery model (e.g. INT-CTXT for authenticated encryption).
SIGNATURE_UNFORGEABILITY: define chosen-message attack and EUF-CMA or stronger target.
HASH_COLLISION_RESISTANCE: computationally infeasible to find distinct x,y with H(x)=H(y), under stated assumptions.
NONCE_POLICY: never reuse a nonce with the same key when a scheme requires nonce uniqueness.
KEY_POLICY: enforce key generation quality, separation of uses, rotation, storage and revocation policies.
RANDOMNESS_POLICY: cryptographic randomness must meet the chosen scheme's security requirements.
SIDE_CHANNEL_POLICY: implementation timing, memory and fault leakage are distinct from abstract algorithm proofs.
SECURITY_LEVEL: security strength is conditional on parameters, assumptions, implementations and evolving attacks.
7. SEMANTIC_EQUIVALENCE
'secret-key encryption' ~ 'symmetric encryption' only in matching contexts.
'public-key encryption' ~ 'asymmetric encryption' for encryption schemes, not all asymmetric primitives.
'message digest' ~ 'hash output' for a specified hash function.
'authentication' != 'authorisation'.
'encoding' != 'encryption'.
'hashing' != 'encryption'.
'digital signature' != 'message authentication code'.
'integrity' != 'confidentiality'.
'computational security' != 'information-theoretic security'.
8. INFERENCE RULES
IF valid_signature(pk,m,sig) AND authenticated_binding(pk,identity)
THEN infer message_signature_valid_for_bound_key;
DO NOT infer sender intent or uncompromised private key without extra premises.
IF aead_tag_invalid THEN reject_plaintext_output.
IF nonce_reuse_violation THEN flag_security_assumption_breach; DO NOT assert a universal concrete exploit.
IF security_claim lacks threat_model OR assumptions THEN mark claim UNDER_SPECIFIED.
IF primitive_correctness_passes THEN infer functional_correctness_only.
IF proof_verified AND assumptions_hold AND implementation_matches_model
THEN infer model_scoped_security_claim, not unconditional real-world security.
9. VALIDATION
CHECK type_compatibility across algorithms, keys, messages and parameters.
CHECK encryption_decryption_roundtrip for supported test vectors.
CHECK signature verification with valid and modified messages.
CHECK authenticated decryption rejects modified ciphertext, tag and AAD.
CHECK nonce and key management constraints.
CHECK key lengths, parameter sets and cryptographic library requirements.
CHECK threat model and scope for every security assertion.
CHECK no conflation of encoding, hashing, encryption, signing and MACs.
CHECK no claim of security based solely on functional test success.
10. EXAMPLE FLOW
INPUT: message m; AEAD key k; fresh nonce n; associated data aad
REQUIRE: k valid; n satisfies scheme nonce policy
c := SymEncrypt(k,n,m,aad)
m2 := SymDecrypt(k,n,c,aad)
ASSERT: m2 = m
tampered := modify(c)
ASSERT: SymDecrypt(k,n,tampered,aad) = FAIL (except with scheme-bounded forgery probability)
OUTPUT: functional test results + explicit limits of the security claim
11. CONFIDENCE
DEFINITIONS_AND_STANDARD_IDENTITIES: HIGH when matched to established cryptographic definitions.
SECURITY_ASSERTIONS: CONDITIONAL on formal model, algorithm, parameters and implementation evidence.
SOURCE_PAGE_ALIGNMENT: UNVERIFIED; page text not independently retrieved.
Avoid numeric confidence without a documented calibration method.
12. FLOW_HASH
METHOD: SHA-256 of canonical UTF-8 file bytes after final publication.
VALUE: NOT_COMPUTED_IN_DOCUMENT
RULE: recompute on any change; do not mistake the flow hash for a signature or proof of correctness.
13. UPDATE_MODEL
TRIGGERS: changes to cryptographic standards, attacks, security proofs, implementations or source ontology.
STEPS: review assumptions -> revise typed model -> rerun validation -> version change -> recompute FLOW_HASH.
RECORD: update date, rationale, affected claims, reviewer and provenance.
14. AI_CONSUMPTION
INPUTS: typed entities, scoped relationships, constraints and evidence metadata.
OUTPUTS: structured explanations, validation checks, traceable inference and explicit uncertainty.
REQUIRE: preserve distinctions between functional correctness and adversarial security.
RESTRICT: do not treat ontology descriptions as executable cryptographic implementations.
PROVENANCE: https://kirethresearch.org
END FLOW ALGEBRA
Download Code
Copy to Clipboard