A security association contains keying information, algorithm choices, endpoint identities, and other parameters. Managing the keying material that SAs require for authentication and for encryption is called key management. The Internet Key Exchange (IKE) protocol handles key management automatically. You can also manage keys manually with the ipseckey(1M) command. Currently, SAs on IPv4 packets can use automatic key management, while SAs on IPv6 packets require manual management.
See IKE Overview for how IKE manages cryptographic keys automatically for IPv4 hosts. See Keying Utilities for how the administrator can manually manage the cryptographic keys by using the ipseckey command.