.. module:: barbican.plugin.interface.secret_store

===============================
Secret Store Plugin Development
===============================

This guide describes how to develop a custom secret store plugin for use by
Barbican.

Barbican supports two storage modes for secrets: a secret store mode (detailed
on this page), and a :doc:`cryptographic mode </contributor/plugin/crypto>`. The secret
store mode offloads both encryption/decryption and encrypted secret storage to
the plugin implementation. Barbican includes plugin interfaces to a Red Hat
Dogtag service and to a Key Management Interoperability Protocol (KMIP)
compliant security appliance.

Since the secret store mode defers the storage of encrypted secrets to plugins,
Barbican core does not need to store encrypted secrets into its data store,
unlike the :doc:`cryptographic mode </contributor/plugin/crypto>`. To accommodate the
discrepancy between the two secret storage modes, a secret store to
cryptographic plugin adapter has been included in Barbican core, as detailed in
:ref:`plugin-secret-store-crypto-adapter-label` section below.


``secret_store`` Module
=======================

The ``barbican.plugin.interface.secret_store`` module contains the classes
needed to implement a custom plugin.  These classes include the
``SecretStoreBase`` abstract base class which custom plugins should inherit
from, as well as several Data Transfer Object (DTO) classes used to transfer
data between Barbican and the plugin.

Data Transfer Objects
=====================

The DTO classes are used to wrap data that is passed from Barbican to the
plugin as well as data that is returned from the plugin back to Barbican.
They provide a level of isolation between the plugins and Barbican's internal
data models.

.. autoclass:: SecretDTO

.. autoclass:: AsymmetricKeyMetadataDTO

Secret Parameter Objects
========================

The secret parameter classes encapsulate information about secrets to be stored
within Barbican and/or its plugins.


.. autoclass:: SecretType

.. a                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           