GNUnet  0.11.x
Public Member Functions | Static Public Attributes
gnunet-chk.AESKey Class Reference
Inheritance diagram for gnunet-chk.AESKey:
[legend]
Collaboration diagram for gnunet-chk.AESKey:
[legend]

Public Member Functions

def __init__ (self, passphrase)
 

Static Public Attributes

 key = None
 
 iv = None
 
 cipher = None
 
int KEY_SIZE = 32
 
 IV_SIZE = AES.block_size
 

Detailed Description

Class for AES Keys. Contains the main key and the initialization
vector. 

Definition at line 93 of file gnunet-chk.py.

Constructor & Destructor Documentation

◆ __init__()

def gnunet-chk.AESKey.__init__ (   self,
  passphrase 
)
Creates a new AES key.

passphrase: string containing the passphrase to get the AES key and
initialization vector

Definition at line 103 of file gnunet-chk.py.

References gnunet-chk.AESKey.iv, TransportDVBoxMessage.iv, gnunet-chk.AESKey.IV_SIZE, QueryMessage.key, ConfigEntry.key, MapEntry.key, BigMapEntry.key, Value.key, GNUNET_DHT_ClientGetStopMessage.key, DataRecord.key, MpiElement.key, SmallMapEntry.key, DestinationEntry.key, GNUNET_SCALARPRODUCT_ComputationHandle.key, GNUNET_DHT_ClientGetMessage.key, RegexAcceptBlock.key, Zone.key, gnunet-chk.AESKey.key, GNUNET_DHT_GetHandle.key, SetEntry.key, GetRequestContext.key, GNUNET_PEERSTORE_Record.key, GNUNET_DHT_ClientGetResultSeenMessage.key, GetKeyMessage.key, GNUNET_PEERSTORE_StoreContext.key, PeerPutMessage.key, ClientMonitorRecord.key, GNUNET_DHT_ClientResultMessage.key, GNUNET_DHT_MonitorHandle.key, Plugin.key, PeerResultMessage.key, GNUNET_PEERSTORE_IterateContext.key, TaskEntry.key, GNUNET_SCALARPRODUCT_Element.key, HandleResultContext.key, GNUNET_DHT_ClientPutMessage.key, DataMessage.key, PeerGetMessage.key, GNUNET_DHT_MonitorPutMessage.key, GNUNET_TESTBED_Barrier.key, GNUNET_DHT_MonitorStartStopMessage.key, GNUNET_CRYPTO_AuthKey.key, ProxyCA.key, ReferendumEntry.key, ProxyGNSCertificate.key, GNUNET_DHT_MonitorGetMessage.key, DiffEntry.key, GNUNET_DHT_MonitorGetRespMessage.key, ContentHashKey.key, GetClosestContext.key, KeyCacheLine.key, RecentRequest.key, RevocationData.key, GNUNET_FS_SearchResult.key, ClientQueryRecord.key, gnunet-chk.AESKey.KEY_SIZE, and len.

103  def __init__(self, passphrase):
104  """Creates a new AES key.
105 
106  passphrase: string containing the passphrase to get the AES key and
107  initialization vector
108  """
109  passphrase = bytearray(passphrase)
110  self.key = bytearray(self.KEY_SIZE)
111  self.iv = bytearray(self.IV_SIZE)
112  if (len(passphrase) > self.KEY_SIZE):
113  self.key = passphrase[:self.KEY_SIZE]
114  passphrase = passphrase[self.KEY_SIZE:]
115  if (len(passphrase) > self.IV_SIZE):
116  self.iv = passphrase[:self.IV_SIZE]
117  else:
118  self.iv[0:len(passphrase)] = passphrase
119  else:
120  self.key[0:len(passphrase)] = passphrase
121  self.key = str(self.key)
122  self.iv = str(self.iv)
123  assert (len(self.key) == self.KEY_SIZE)
124  assert (len(self.iv) == self.IV_SIZE)
125 
126 
uint16_t len
length of data (which is always a uint32_t, but presumably this can be used to specify that fewer byt...

Field Documentation

◆ key

gnunet-chk.AESKey.key = None
static

◆ iv

gnunet-chk.AESKey.iv = None
static

Definition at line 98 of file gnunet-chk.py.

Referenced by gnunet-chk.AESKey.__init__().

◆ cipher

gnunet-chk.AESKey.cipher = None
static

Definition at line 99 of file gnunet-chk.py.

◆ KEY_SIZE

int gnunet-chk.AESKey.KEY_SIZE = 32
static

Definition at line 100 of file gnunet-chk.py.

Referenced by gnunet-chk.AESKey.__init__().

◆ IV_SIZE

gnunet-chk.AESKey.IV_SIZE = AES.block_size
static

Definition at line 101 of file gnunet-chk.py.

Referenced by gnunet-chk.AESKey.__init__().


The documentation for this class was generated from the following file: