castellan/common/objects/opaque_data.py
---------------------------------------
class OpaqueData(managed_object.ManagedObject):
"""This class represents opaque data."""
def __init__(self, data, name=None, created=None, id=None):
"""Create a new OpaqueData object.
Expected type for data is a bytestring.
"""
self._data = data super(OpaqueData, self).__init__(name=name, created=created, id=id)
def get_encoded(self):
"""Returns the data in its original format."""
return self._data
Ok OpaqueData.__init__() expects a bytestring for data so appears it should already be encoded when the object is initialized and get_encoded() should just return the already encoded string.
Which get_encoded() is getting called?
In barbican's store_secret() this line is called:
opaque_ data.OpaqueData (secret_ dto.secret)
castellan/ common/ objects/ opaque_ data.py ------- ------- ------- ------- ---- managed_ object. ManagedObject) :
-------
class OpaqueData(
"""This class represents opaque data."""
def __init__(self, data, name=None, created=None, id=None):
"""Create a new OpaqueData object.
Expected type for data is a bytestring.
super( OpaqueData, self)._ _init__ (name=name, created=created, id=id)
"""
self._data = data
@property
def format(self):
"""This method returns 'Opaque'."""
return "Opaque"
def get_encoded(self):
"""Returns the data in its original format."""
return self._data
Ok OpaqueData. __init_ _() expects a bytestring for data so appears it should already be encoded when the object is initialized and get_encoded() should just return the already encoded string.