{"record":{"id":"5cdbd5e1fa89e84d","repo":"AlexxIT/go2rtc","slug":"ciphersuite-not-initialized","errorCode":null,"errorMessage":"CipherSuite not initialized","messagePattern":"CipherSuite not initialized","errorType":"error_code","errorClass":"protocol.TemporaryError","httpStatus":null,"severity":"error","filePath":"pkg/tutk/dtls/cipher.go","lineNumber":29,"sourceCode":"\n\t\"github.com/pion/dtls/v3\"\n\t\"github.com/pion/dtls/v3/pkg/crypto/clientcertificate\"\n\t\"github.com/pion/dtls/v3/pkg/crypto/prf\"\n\t\"github.com/pion/dtls/v3/pkg/protocol\"\n\t\"github.com/pion/dtls/v3/pkg/protocol/recordlayer\"\n\t\"golang.org/x/crypto/chacha20poly1305\"\n)\n\nconst CipherSuiteID_CCAC dtls.CipherSuiteID = 0xCCAC\n\nconst (\n\tchachaTagLength   = 16\n\tchachaNonceLength = 12\n)\n\nvar (\n\terrDecryptPacket      = &protocol.TemporaryError{Err: errors.New(\"failed to decrypt packet\")}\n\terrCipherSuiteNotInit = &protocol.TemporaryError{Err: errors.New(\"CipherSuite not initialized\")}\n)\n\ntype ChaCha20Poly1305Cipher struct {\n\tlocalCipher, remoteCipher   cipher.AEAD\n\tlocalWriteIV, remoteWriteIV []byte\n}\n\nfunc NewChaCha20Poly1305Cipher(localKey, localWriteIV, remoteKey, remoteWriteIV []byte) (*ChaCha20Poly1305Cipher, error) {\n\tlocalCipher, err := chacha20poly1305.New(localKey)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tremoteCipher, err := chacha20poly1305.New(remoteKey)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n","sourceCodeStart":11,"sourceCodeEnd":47,"githubUrl":"https://github.com/AlexxIT/go2rtc/blob/c245815e75e2a5fd60b4290f12bfc04e55a984d3/pkg/tutk/dtls/cipher.go#L11-L47","documentation":"TUTK DTLS cipher sentinel (protocol.TemporaryError): Encrypt/Decrypt was called but c.aead.Load() holds no *ChaCha20Poly1305Cipher — the cipher suite was used before Init stored the AEAD (handshake not finished, or the CCAC suite was never initialized). Every encrypt/decrypt attempt fails until initialization completes.","triggerScenarios":"Thrown at pkg/tutk/dtls/cipher.go:29 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the cipher suite's Init/InstallKeys ran before traffic flows (complete the handshake first)","Treat as temporary: queue or drop packets until the AEAD is set","Check the negotiated suite actually is CCAC before binding this cipher"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"c245815e75e2a5fd60b4290f12bfc04e55a984d3","analyzedAt":"2026-09-07T11:47:02.965Z","contentChangedAt":"2026-09-07T11:47:02.965Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}