I am implementing TLS (or something like it perhaps) because the browser doesn't seem to provide a direct client-script interface to TLS. The browser provides a SubtleCrypto.encrypt()
function that claims to do AES-GCM. However, the documentation for this function does not mention an input for RFC 5246/5116 AEAD Associated Data A which is authenticated but not encrypted.
Is there a way to use the existing SubtleCrypto.encrypt()
function that includes the standard Associated Data A in a TLS-compatible way?
If not, then at minimum I would like to include the SN (TLS Sequence Number) somewhere, to prevent full-record replay attacks. Apart from TLS incompatibility, are there any potential drawbacks to simply adding the SN onto the session IV (which is an input to SubtleCrypto.encrypt()
?)
TLS 1.2 definitely requires the SN in AEAD but maybe I don't care? (Does anyone still use TLS 1.2?)
The last time I implemented TLS 1.3, it had the SN in both the IV and AEAD Associated Data A. But AEAD may have been deprecated since then. Maybe that's why SubtleCrypto.encrypt()
doesn't have the AEAD Associated Data A input? Surely the SN doesn't need to be included twice?