Machina Client SDK Version 2.1.2
Ionic Security Machina Client SDK for Python users
Functions
ionicsdk.cryptoutil Namespace Reference

Functions

def sha256 (inbytes)
 Generate a SHA256 hash code. More...
 
def hmac_sha256 (inbytes, keybytes)
 Generate a HMAC_SHA256 hash code. More...
 
def sha512 (inbytes)
 Generate a SHA512 hash code. More...
 
def hmac_sha512 (inbytes, keybytes)
 Generate a HMAC_SHA512 hash code. More...
 
def pbkdf2 (inbytes, saltbytes, iterations, hashlen)
 Performs the PBKDF2 key derivation algorithm on provided input bytes and optional salt. More...
 
def initialize ()
 Initialize the crypto library. More...
 
def shutdown ()
 Shutdown the crypto library. More...
 
def setCryptoSharedLibraryFipsMode (isFips)
 Sets whether on the Windows, Mac, or Linux platform, ISCRYPTO will load a FIPS approved crypto module or not. More...
 
def setCryptoSharedLibraryCustomDirectory (sharedDirectory)
 Allows the user to set a custom folder for Ionic to check for the Crypto module. More...
 
def setCryptoSharedLibraryCustomPath (sharedLibPath)
 Allows the user to use a custom crypto module. More...
 
def getCryptoSharedLibraryLoadedFilename ()
 Gets the full path filename of the crypto module loaded or an empty string otherwise. More...
 

Detailed Description

Various cryptographics functions.

Function Documentation

◆ getCryptoSharedLibraryLoadedFilename()

def ionicsdk.cryptoutil.getCryptoSharedLibraryLoadedFilename ( )

Gets the full path filename of the crypto module loaded or an empty string otherwise.

Allows the user to check if the crypto module has loaded and if it is the correct module.

Returns
Full path filename of the crypto module loaded or an empty string otherwise.

◆ hmac_sha256()

def ionicsdk.cryptoutil.hmac_sha256 (   inbytes,
  keybytes 
)

Generate a HMAC_SHA256 hash code.

Parameters
inbytes(bytes): The data to hash
keybytes(bytes): The key bytes
Returns
(bytes) The 256 bit hash as a byte array

◆ hmac_sha512()

def ionicsdk.cryptoutil.hmac_sha512 (   inbytes,
  keybytes 
)

Generate a HMAC_SHA512 hash code.

Parameters
inbytes(bytes): The data to hash
keybytes(bytes): The key bytes
Returns
(bytes) The 256 bit hash as a byte array

◆ initialize()

def ionicsdk.cryptoutil.initialize ( )

Initialize the crypto library.

This function must be called before any function from any part of the cryptography library may be called. Applications typically call this function during startup before doing any work.

NOTE: crypto functions will call this function as needed, so the only reason the user might want to call it themselves is to check for a bad result or to force the crypto module to load at a convenient earlier time.

This function may be called redundantly, and when called this way, it throws the exception from the initial call, if any error occurred at that time.

Returns
None

◆ pbkdf2()

def ionicsdk.cryptoutil.pbkdf2 (   inbytes,
  saltbytes,
  iterations,
  hashlen 
)

Performs the PBKDF2 key derivation algorithm on provided input bytes and optional salt.

Parameters
inbytes(bytes): The data to hash
saltbytes(bytes): The salt bytes
iterations(int): The number of iterations (must be greater than zero)
hashlen(int): The length of the desired output hash length, which must be greater than zero. The computed hash will be this length.
Returns
(bytes) The output bytes

◆ setCryptoSharedLibraryCustomDirectory()

def ionicsdk.cryptoutil.setCryptoSharedLibraryCustomDirectory (   sharedDirectory)

Allows the user to set a custom folder for Ionic to check for the Crypto module.

As an example, the SDK, by default, checks for the crypto module in the same directory as the currently running executable. However, an installation may place these in a central location.

Parameters
[in]sharedDirectory(unicode) directory to find the crypto module.
Returns
None

◆ setCryptoSharedLibraryCustomPath()

def ionicsdk.cryptoutil.setCryptoSharedLibraryCustomPath (   sharedLibPath)

Allows the user to use a custom crypto module.

The module must contain specific Ionic API. This overrides any other settings regarding which crypto module to load.

Parameters
[in]sharedLibPath(unicode) full path name of a custom crypto shared library.
Returns
None

◆ setCryptoSharedLibraryFipsMode()

def ionicsdk.cryptoutil.setCryptoSharedLibraryFipsMode (   isFips)

Sets whether on the Windows, Mac, or Linux platform, ISCRYPTO will load a FIPS approved crypto module or not.

The FIPS approved module will be older code, in general, and on Linux, may block waiting for entropy.

Parameters
[in]isFips(bool) true for FIPS module, false for the alternate
Returns
None

◆ sha256()

def ionicsdk.cryptoutil.sha256 (   inbytes)

Generate a SHA256 hash code.

Parameters
inbytes(bytes): The data to hash
Returns
(bytes) The 256 bit hash as a byte array

◆ sha512()

def ionicsdk.cryptoutil.sha512 (   inbytes)

Generate a SHA512 hash code.

Parameters
inbytes(bytes): The data to hash
Returns
(bytes) The 256 bit hash as a byte array

◆ shutdown()

def ionicsdk.cryptoutil.shutdown ( )

Shutdown the crypto library.

This function should be called before the application terminates or when the crypto library is no longer needed. This gives the crypto library a chance to release any resources that were allocated by initialization or during operation. This function calls the crypto module shutdown internally and then unloads the crypto module.

A user might use this to unload a crypto module in preparation for loading some other alternate module. Users should do this with great care as any memory allocated by the old module will have undefined behavior with the new module - for example, an RSA key generated or loaded using the crypto API. This data will likely contain entirely different formats internally.

Returns
None