Are there are any (properly specified) meta-formats / schema formats for describing cryptographic message structures?
I'm looking for a way to describe the format (where some channels might want symmetric/asymmetric encoding or signatures) that's not just "This uses scheme #5 - see the docs for more".
Having it computer-readable would let me do some fun tinkering - things like programmatically deducing what information has to be pre-shared for the scheme to work, deducing which parts of the message have integrity, producing a report of the scheme's properties (including errors due to insufficient padding etc.) - but it also just feels neater to me to have a language to express things in.
As illustrative (not actual syntax!) examples, something like:
random-iv[128] + CTR[AES](shared-secret[256], iv, message)
- IV, followed by AES-256-CTR encoded message (shared secret unspecified)message + your-key[2048].public + RSA[DECODE](your-key[2048], random-padding[256] + SHA256(message))
- message followed by public key and RSA signature of SHA-256 hashHMAC[SHA256]({0x123456...}, message) + message
- HMAC first (secret as literal), concatenated with messageRSA[ENCODE]({0x...my-key-literal}, random-iv[128] + random-key[256]) + CTR[AES](random-key[256], random-iv[128], message)
- specify my encryption key, and use AES-256 for message with random key
If there weren't any hard-coded values (e.g. the HMAC secret wasn't a literal), then it would describe the generic scheme.
With hard-coded values you could describe the data expected on a particular channel, and even verify that it's a subset of the generic scheme.
This is slightly analogous to things like ASN.1 for structured data (which lets you describe the internal structure of a binary stream, and even the bitwise layout when combined with something like PER), but possibly more like an equation/functional-expression, with cryptographic primitives and unknowns etc..
It seems like it should be possible, but I couldn't find anything. Are there existing meta-formats for this for crypto?