Client SDK Version 2.0.0
Ionic Security client SDK for Python users
Public Member Functions | List of all members
ionicsdk.keyvault.KeyVaultCustom Class Reference

Key Vault Class that allows for the creation of a completely custom vault. More...

Inheritance diagram for ionicsdk.keyvault.KeyVaultCustom:
ionicsdk.keyvault.KeyVault

Public Member Functions

def __init__ (self, vaultId, vaultLabel, vaultSecLev)
 Constructs the base part of a custom key vault from passed in arguments. More...
 
def EnableSyncCallbacks (self)
 Call this to enable callbacks to the SyncKeys method. More...
 
def EnableFileLoadSaveCallbacks (self)
 Call this to enable callbacks to the SaveAllKeys and LoadAllKeys methods. More...
 
def GetKeyState (self, keyid)
 Outside of the context of a SyncKeys() callback, the Python copy of the vault keys will not have valid state values. More...
 
def UpdateKeyState (self, keyid, newState)
 Inside the context of a SyncKeys() callback, the code should either update the states ISKR_UPDATED and ISKR_ADDED to ISKR_STORED, or delete keys with the status of ISKR_REMOVED. More...
 
def DeleteKey (self, keyid)
 Inside the context of a SyncKeys() callback, the code should either update the states ISKR_UPDATED and ISKR_ADDED to ISKR_STORED, or delete keys with the status of ISKR_REMOVED. More...
 
def SyncKeys (self, keyVaultKeys)
 
def SaveAllKeys (self, keyVaultKeys)
 Callback enabled by EnableFileLoadSaveCallbacks(). More...
 
def LoadAllKeys (self)
 Callback enabled by EnableFileLoadSaveCallbacks(). More...
 
def CleanVaultStore (self)
 Optional function used to clean up a corrupt key storage file. More...
 
- Public Member Functions inherited from ionicsdk.keyvault.KeyVault
def __init__ (self)
 Constructs a default key vault.
 
def SetKey (self, keyVaultKeyRecord, addIfNotFound)
 
def GetKey (self, keyid)
 Get a single key from the key vault. More...
 
def GetKeys (self, keyids)
 Get multiple keys from the key vault. More...
 
def GetAllKeyIds (self)
 Get the list of all key IDs in the key vault. More...
 
def GetAllKeys (self)
 Get the list of all key objects in the key vault. More...
 
def GetKeyCount (self)
 Get the number of keys in the key vault. More...
 
def HasKey (self, keyid)
 Determine if a key exists in the key vault. More...
 
def RemoveKey (self, keyid)
 Remove a single key from the key vault. More...
 
def RemoveKeys (self, keyids)
 Remove one or more keys from the key vault. More...
 
def ClearAllKeys (self)
 Remove all keys from the key vault. More...
 
def ExpireKeys (self)
 Remove all keys which have expired. More...
 
def Sync (self)
 
def HasChanges (self)
 Determine if there are any changes to the key vault in memory that necessitate a sync(). More...
 

Additional Inherited Members

- Static Public Attributes inherited from ionicsdk.keyvault.KeyVault
int ISKEYVAULT_OK = 0
 Key Vault Error Codes - Success code.
 
int ISKEYVAULT_ERROR_BASE = 16000
 Key Vault Error Codes - error code range base.
 
int ISKEYVAULT_ERROR = 16001
 Key Vault Error Codes - A general error occurred, but its specific problem is not represented with its own code.
 
int ISKEYVAULT_UNKNOWN = 16002
 Key Vault Error Codes - An unknown and unexpected error occurred.
 
int ISKEYVAULT_NOMEMORY = 16003
 Key Vault Error Codes - A memory allocation failed. More...
 
int ISKEYVAULT_MISSINGVALUE = 16004
 Key Vault Error Codes - An expected and required value was not found. More...
 
int ISKEYVAULT_INVALIDVALUE = 16005
 Key Vault Error Codes - A value was found that is invalid. More...
 
int ISKEYVAULT_KEY_NOT_FOUND = 16006
 Key Vault Error Codes - A key was not found. More...
 
int ISKEYVAULT_KEY_UPDATE_IGNORED = 16007
 Key Vault Error Codes - A key update request was ignored. More...
 
int ISKEYVAULT_OPENFILE = 16008
 Key Vault Error Codes - A file failed to open. More...
 
int ISKEYVAULT_EOF = 16009
 Key Vault Error Codes - The end of a file was found before it was expected. More...
 
int ISKEYVAULT_NOHEADER = 16010
 Key Vault Error Codes - A file header could not be found where it was expected. More...
 
int ISKEYVAULT_PARSEFAILED = 16011
 Key Vault Error Codes - The parsing of some serialized data failed. More...
 
int ISKEYVAULT_HEADER_MISMATCH = 16012
 Key Vault Error Codes - A key vault file header has values which were not expected. More...
 
int ISKEYVAULT_LOAD_NOT_NEEDED = 16013
 Key Vault Error Codes - A key vault load operation was skipped because it was not needed. More...
 
int ISKEYVAULT_CREATE_PATH = 16014
 Key Vault Error Codes - A key vault save operation could not create the required file path. More...
 
int ISKEYVAULT_INVALID_KEY = 16015
 Key Vault Error Codes - A key is invalid in some way (key ID, key bytes, etc). More...
 
int ISKEYVAULT_RESOURCE_NOT_FOUND = 16016
 Key Vault Error Codes - A resource was not found. More...
 
int ISKEYVAULT_FILE_VERSION = 16017
 Key Vault Error Codes - A key vault file load operation failed due to unsupported file version. More...
 

Detailed Description

Key Vault Class that allows for the creation of a completely custom vault.

The user has two options in this regard.

Constructor takes an ID (string), Label (string), and Security Level (int) argument

Constructor & Destructor Documentation

◆ __init__()

def ionicsdk.keyvault.KeyVaultCustom.__init__ (   self,
  vaultId,
  vaultLabel,
  vaultSecLev 
)

Constructs the base part of a custom key vault from passed in arguments.

Parameters
vaultId(string) The vault unique type ID.
vaultLabel(string) The human readable vault label.
vaultSecLev(int) - An arbitrary integer security level - comparable against other key vaults.

Member Function Documentation

◆ CleanVaultStore()

def ionicsdk.keyvault.KeyVaultCustom.CleanVaultStore (   self)

Optional function used to clean up a corrupt key storage file.

There is no need to implement this via any callback as it is not at present called directly by the wrapped SDK code anyway. It should be implemented so that a potentially corrupt key storage can be repaired at the application level.

Returns
None

Reimplemented from ionicsdk.keyvault.KeyVault.

◆ DeleteKey()

def ionicsdk.keyvault.KeyVaultCustom.DeleteKey (   self,
  keyid 
)

Inside the context of a SyncKeys() callback, the code should either update the states ISKR_UPDATED and ISKR_ADDED to ISKR_STORED, or delete keys with the status of ISKR_REMOVED.

This function permanently deletes a key from the native code storage.

Parameters
keyid(string) The Key ID or identifying tag
Returns
(int) ISKEYVAULT_OK on success or ISKEYVAULT_INVALIDVALUE if this instance is corrupt somehow

◆ EnableFileLoadSaveCallbacks()

def ionicsdk.keyvault.KeyVaultCustom.EnableFileLoadSaveCallbacks (   self)

Call this to enable callbacks to the SaveAllKeys and LoadAllKeys methods.

If this is called from a class implementation without both methods overrided, then the base class will raise an exception on the first call to Sync()

Returns
None

◆ EnableSyncCallbacks()

def ionicsdk.keyvault.KeyVaultCustom.EnableSyncCallbacks (   self)

Call this to enable callbacks to the SyncKeys method.

If this is called from a class implementation without a SyncKeys override, then the base class will raise an exception on the first call to Sync()

Returns
None

◆ GetKeyState()

def ionicsdk.keyvault.KeyVaultCustom.GetKeyState (   self,
  keyid 
)

Outside of the context of a SyncKeys() callback, the Python copy of the vault keys will not have valid state values.

Use this function to retrieve the current state. See class KeyVaultKeyRecord for valid values.

Parameters
keyid(string) The Key ID or identifying tag
Returns
(KeyVaultKeyRecord enum) Current key state

◆ LoadAllKeys()

def ionicsdk.keyvault.KeyVaultCustom.LoadAllKeys (   self)

Callback enabled by EnableFileLoadSaveCallbacks().

You must sub class and override this method to use this.

Function should retrieve the key data from long term storage and return the list of keys as a KeyVaultKeyRecordList. The native implementation of Sync() will update the key vault key state in this case.

Returns
(KeyVaultKeyRecordList) A list of the keys loaded

◆ SaveAllKeys()

def ionicsdk.keyvault.KeyVaultCustom.SaveAllKeys (   self,
  keyVaultKeys 
)

Callback enabled by EnableFileLoadSaveCallbacks().

You must sub class and override this method to use this.

Parameters
keyVaultKeys- (KeyVaultKeyRecordList) A list of KeyVaultKeyRecords with valid state.

Function should move the key data to long term storage. The native implementation of Sync() will update the key vault key state in this case.

Returns
(int) ISKEYVAULT_OK on success or some other meaningful error code

◆ SyncKeys()

def ionicsdk.keyvault.KeyVaultCustom.SyncKeys (   self,
  keyVaultKeys 
)

Callback enabled by EnableSyncCallbacks(). You must sub class and override this method to use this.

Parameters
keyVaultKeys- (KeyVaultKeyRecordList) A list of KeyVaultKeyRecords with valid state. Use the state to determine new or updated keys and keys marked for removal. This function should move the key vault data into long term storage and then update keys to the stored state or permanently remove them if so marked.
Returns
(int) ISKEYVAULT_OK on success or some other meaningful error code

◆ UpdateKeyState()

def ionicsdk.keyvault.KeyVaultCustom.UpdateKeyState (   self,
  keyid,
  newState 
)

Inside the context of a SyncKeys() callback, the code should either update the states ISKR_UPDATED and ISKR_ADDED to ISKR_STORED, or delete keys with the status of ISKR_REMOVED.

This function updates the state. It is insufficient to simply change the state on the Python object as it is a local cop of the actual key data stored in the native code.

Parameters
keyid(string) The Key ID or identifying tag
newState(string) The new state to set on the key
Returns
(int) ISKEYVAULT_OK on success or ISKEYVAULT_INVALIDVALUE if this instance is corrupt somehow

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