{
    "mode": "man",
    "parameter": "life_cycle-cipher",
    "section": "7",
    "url": "https://www.chedong.com/phpMan.php/man/life_cycle-cipher/7/json",
    "generated": "2026-09-24T15:04:15Z",
    "sections": {
        "NAME": {
            "content": "lifecycle-cipher - The cipher algorithm life-cycle\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "All symmetric ciphers (CIPHERs) go through a number of stages in their life-cycle:\n\nstart\nThis  state represents the CIPHER before it has been allocated.  It is the starting state\nfor any life-cycle transitions.\n\nnewed\nThis state represents the CIPHER after it has been allocated.\n\ninitialised\nThese states represent the CIPHER when it is set up  and  capable  of  processing  input.\nThere are three possible initialised states:\n\ninitialised using EVPCipherInit\ninitialised for decryption using EVPDecryptInit\ninitialised for encryption using EVPEncryptInit\nupdated\nThese  states represent the CIPHER when it is set up and capable of processing additional\ninput or generating output.  The three possible states directly correspond to  those  for\ninitialised above.  The three different streams should not be mixed.\n\nfinaled\nThis state represents the CIPHER when it has generated output.\n\nfreed\nThis  state  is entered when the CIPHER is freed.  It is the terminal state for all life-\ncycle transitions.\n",
            "subsections": [
                {
                    "name": "State Transition Diagram",
                    "content": "The usual life-cycle of a CIPHER is illustrated:\n+---------------------------+\n|                           |\n|           start           |\n|                           |\n+---------------------------+   + - - - - - - - - - - - -  -\n+\n|                          '   any  of the initialised\n'\n| EVPCIPHERCTXnew      ' updated or finaled  states\n'\nv                                                    '\n'\n+---------------------------+   + - - - - - - - - - - - -  -\n+\n|                           |      |\n|           newed           |      | EVPCIPHERCTXreset\n|                           | <----+\n+---------------------------+\n|   |                 |\n+---------+   |                 +---------+\nEVPDecryptInit |             | EVPCipherInit            | EVPEncryptInit\nv             v                           v\n+---------------------------+                                  +---------------------------+\n+---------------------------+\n|                                 |          |                                  |          |\n|\n|          initialised         |    |         initialised         |    |         initialised\n|\n|       for decryption       |    |                            |    |        for  encryption\n|\n+---------------------------+                                  +---------------------------+\n+---------------------------+\n|                                   |                                                   |\n| EVPDecryptUpdate                 | EVPCipherUpdate                EVPEncryptUpdate |\n|                                   v                                                   |\n|                             +---------------------------+                             |\n|                             |                           |--------------------+        |\n|                             |          updated          |   EVPCipherUpdate |        |\n|                             |                           | <------------------+        |\nv                             +---------------------------+                             v\n+---------------------------+                                                              |\n+---------------------------+\n|                                    |---------------------+            |                  |\n|\n|           updated           |    EVPDecryptUpdate  |     |           |            updated\n|------+\n|        for  decryption       |  <-------------------+    |          |       for encryption\n|      |\n+---------------------------+                                                              |\n+---------------------------+      |\n|               EVPCipherFinal    |               |              ^\n|\n+-------+                        |       +--------+               |\n|\nEVPDecryptFinal     |                        |       |     EVPEncryptFinal\n+-------------------+\nv                                    v                    v\nEVPEncryptUpdate\n+---------------------------+\n|                           |-----------------------------+\n|          finaled          |                             |\n|                           | <---------------------------+\n+---------------------------+   EVPCIPHERCTXgetparams\n|                             (AEAD encryption)\n| EVPCIPHERCTXfree\nv\n+---------------------------+\n|                           |\n|           freed           |\n|                           |\n+---------------------------+\n"
                },
                {
                    "name": "Formal State Transitions",
                    "content": "This section defines all of the legal state transitions.  This is the canonical list.\nFunction  Call                 ----------------------------------------------  Current State\n-----------------------------------------------\nstart      newed       initialised      updated         finaled\ninitialised   updated    initialised   updated    freed\ndecryption\ndecryption   encryption  encryption\nEVPCIPHERCTXnew           newed\nEVPCipherInit                       initialised    initialised    initialised   initialised\ninitialised initialised  initialised initialised\nEVPDecryptInit                     initialised    initialised    initialised    initialised\ninitialised initialised  initialised initialised\ndecryption      decryption      decryption     decryption\ndecryption  decryption  decryption  decryption\nEVPEncryptInit                     initialised    initialised    initialised    initialised\ninitialised initialised  initialised initialised\nencryption      encryption      encryption     encryption\nencryption  encryption  encryption  encryption\nEVPCipherUpdate                                updated     updated\nEVPDecryptUpdate                                                                    updated\nupdated\ndecryption\ndecryption\nEVPEncryptUpdate\nupdated     updated\nencryption\nencryption\nEVPCipherFinal                                             finaled\nEVPDecryptFinal\nfinaled\nEVPEncryptFinal\nfinaled\nEVPCIPHERCTXfree           freed    freed       freed       freed       freed       freed\nfreed        freed       freed\nEVPCIPHERCTXreset                 newed       newed       newed        newed        newed\nnewed        newed       newed\nEVPCIPHERCTXgetparams                     newed            initialised           updated\ninitialised   updated    initialised   updated\ndecryption\ndecryption   encryption  encryption\nEVPCIPHERCTXsetparams                    newed            initialised            updated\ninitialised   updated    initialised   updated\ndecryption\ndecryption   encryption  encryption\nEVPCIPHERCTXgettableparams                newed            initialised           updated\ninitialised   updated    initialised   updated\ndecryption\ndecryption   encryption  encryption\nEVPCIPHERCTXsettableparams               newed            initialised            updated\ninitialised   updated    initialised   updated\ndecryption\ndecryption   encryption  encryption\n"
                }
            ]
        },
        "NOTES": {
            "content": "At some point the EVP layer will begin enforcing the transitions described herein.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "provider-cipher(7), EVPEncryptInit(3)\n",
            "subsections": []
        },
        "COPYRIGHT": {
            "content": "Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.\n\nLicensed  under  the Apache License 2.0 (the \"License\").  You may not use this file except in\ncompliance with the License.  You can obtain a  copy  in  the  file  LICENSE  in  the  source\ndistribution or at <https://www.openssl.org/source/license.html>.\n\n3.0.13                                       2026-07-29                      LIFECYCLE-CIPHER(7SSL)",
            "subsections": []
        }
    },
    "summary": "lifecycle-cipher - The cipher algorithm life-cycle",
    "flags": [],
    "examples": [],
    "see_also": [
        {
            "name": "provider-cipher",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/provider-cipher/7/json"
        },
        {
            "name": "EVPEncryptInit",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/EVPEncryptInit/3/json"
        }
    ]
}