Data Structures | Defines | Functions

# secret.c File Reference

`#include "wizard/studio.h"`
`#include "wizard/cipher.h"`
`#include "wizard/exception.h"`
`#include "wizard/exception-private.h"`
`#include "wizard/hmac.h"`
`#include "wizard/keyring.h"`
`#include "wizard/memory_.h"`
`#include "wizard/passphrase.h"`
`#include "wizard/random_.h"`
`#include "wizard/secret.h"`

## Data Structures
struct | _SecretInfo
## Defines
#define | SecretKeyCipher AESCipher
#define | SecretKeyMode CTRMode
#define | SecretKeyHash SHA256Hash
#define | SecretRandomHash SHA256Hash
## Functions
WizardExport SecretInfo * | AcquireSecretInfo (const char *path, const HashType hash, const size_t key_length)
WizardExport WizardBooleanType | AuthenticateSecretKey (SecretInfo *secret_info, ExceptionInfo *exception)
WizardExport SecretInfo * | DestroySecretInfo (SecretInfo *secret_info)
WizardExport WizardBooleanType | GenerateSecretKey (SecretInfo *secret_info, ExceptionInfo *exception)
WizardExport const StringInfo * | GetSecretId (const SecretInfo *secret_info)
WizardExport const StringInfo * | GetSecretKey (const SecretInfo *secret_info)
WizardExport size_t | GetSecretKeyLength (const SecretInfo *secret_info)
WizardExport const char * | GetSecretPassphrase (const SecretInfo *secret_info)
WizardExport void | SetSecretId (SecretInfo *secret_info, const StringInfo *id)
WizardExport void | SetSecretKeyLength (SecretInfo *secret_info, const size_t key_length)
WizardExport void | SetSecretPassphrase (SecretInfo *secret_info, const char *passphrase)

## Define Documentation

#define SecretKeyCipher AESCipher

Referenced by AcquireSecretInfo().

#define SecretKeyHash SHA256Hash

#define SecretKeyMode CTRMode

Referenced by AcquireSecretInfo().

#define SecretRandomHash SHA256Hash

Referenced by AcquireSecretInfo().

## Function Documentation

WizardExport SecretInfo* AcquireSecretInfo | ( | const char * | path,
|  | const HashType | hash,
|  | const size_t | key_length |
| ) |  |  |

References AcquireCipherInfo(), AcquireHMACInfo(), AcquireKeyringInfo(), AcquireRandomInfo(), AcquireWizardMemory(), AuthenticateDomain, _SecretInfo::cipher_info, GenerateCipherNonce(), _SecretInfo::hmac_info, _SecretInfo::key_length, _SecretInfo::keyring_info, MemoryError, _SecretInfo::nonce, _SecretInfo::random_info, ResetWizardMemory(), SecretKeyCipher, SecretKeyMode, SecretRandomHash, _SecretInfo::signature, ThrowWizardFatalError, and _SecretInfo::timestamp.

Referenced by AcquireAuthenticateInfo().

WizardExport WizardBooleanType AuthenticateSecretKey | ( | SecretInfo * | secret_info,
|  | ExceptionInfo * | exception |
| ) |  |  |

References AuthenticateDomain, _SecretInfo::cipher_info, CloneStringInfo(), CompareStringInfo(), ConstructHMAC(), DecipherCipher(), DestroyStringInfo(), ExportKeyringKey(), FileToStringInfo(), GetHMACDigest(), GetKeyringKey(), GetKeyringNonce(), GetPassphrase(), GetWizardModule, _SecretInfo::hmac_info, _SecretInfo::id, _SecretInfo::key, _SecretInfo::keyring_info, LogWizardEvent(), _SecretInfo::passphrase, SetCipherKey(), SetCipherNonce(), SetKeyringId(), _SecretInfo::signature, TraceEvent, WizardAssert, WizardFalse, WizardSignature, and WizardTrue.

Referenced by AuthenticateKey().

WizardExport SecretInfo* DestroySecretInfo | ( | SecretInfo * | secret_info | ) |

References AuthenticateDomain, _SecretInfo::cipher_info, DestroyCipherInfo(), DestroyHMACInfo(), DestroyKeyringInfo(), DestroyRandomInfo(), DestroyStringInfo(), _SecretInfo::digest, GetWizardModule, _SecretInfo::hmac_info, _SecretInfo::id, _SecretInfo::key, _SecretInfo::keyring_info, LogWizardEvent(), _SecretInfo::nonce, _SecretInfo::random_info, RelinquishWizardMemory(), _SecretInfo::signature, TraceEvent, WizardAssert, and WizardSignature.

Referenced by DestroyAuthenticateInfo().

WizardExport WizardBooleanType GenerateSecretKey | ( | SecretInfo * | secret_info,
|  | ExceptionInfo * | exception |
| ) |  |  |

References AcquireExceptionInfo(), AuthenticateDomain, _SecretInfo::cipher_info, CloneStringInfo(), ConstructHMAC(), DestroyExceptionInfo(), DestroyStringInfo(), EncipherCipher(), ExportKeyringKey(), FileToStringInfo(), GetHMACDigest(), GetKeyringKey(), GetKeyringNonce(), GetPassphrase(), GetRandomKey(), GetWizardModule, _SecretInfo::hmac_info, _SecretInfo::id, ImportKeyringKey(), _SecretInfo::key, _SecretInfo::key_length, _SecretInfo::keyring_info, LogWizardEvent(), _SecretInfo::nonce, _SecretInfo::passphrase, _SecretInfo::random_info, SetCipherKey(), SetCipherNonce(), SetKeyringId(), SetKeyringKey(), SetKeyringNonce(), _SecretInfo::signature, TraceEvent, WizardAssert, WizardFalse, WizardSignature, and WizardTrue.

Referenced by GenerateAuthenticateKey().

WizardExport const StringInfo* GetSecretId | ( | const SecretInfo * | secret_info | ) |

References AuthenticateDomain, GetWizardModule, _SecretInfo::id, LogWizardEvent(), _SecretInfo::signature, TraceEvent, WizardAssert, and WizardSignature.

Referenced by GetAuthenticateId().

WizardExport const StringInfo* GetSecretKey | ( | const SecretInfo * | secret_info | ) |

References AuthenticateDomain, GetWizardModule, _SecretInfo::key, LogWizardEvent(), _SecretInfo::signature, TraceEvent, WizardAssert, and WizardSignature.

Referenced by GetAuthenticateKey().

WizardExport size_t GetSecretKeyLength | ( | const SecretInfo * | secret_info | ) |

References AuthenticateDomain, GetWizardModule, _SecretInfo::key_length, LogWizardEvent(), _SecretInfo::signature, TraceEvent, WizardAssert, and WizardSignature.

Referenced by GetAuthenticateKeyLength().

WizardExport const char* GetSecretPassphrase | ( | const SecretInfo * | secret_info | ) |

References AuthenticateDomain, GetWizardModule, LogWizardEvent(), _SecretInfo::passphrase, _SecretInfo::signature, TraceEvent, WizardAssert, and WizardSignature.

Referenced by GetAuthenticatePassphrase().

WizardExport void SetSecretId | ( | SecretInfo * | secret_info,
|  | const StringInfo * | id |
| ) |  |  |

References CloneStringInfo(), DestroyStringInfo(), and _SecretInfo::id.

Referenced by SetAuthenticateId().

WizardExport void SetSecretKeyLength | ( | SecretInfo * | secret_info,
|  | const size_t | key_length |
| ) |  |  |

References AuthenticateDomain, GetWizardModule, _SecretInfo::key_length, LogWizardEvent(), _SecretInfo::signature, TraceEvent, WizardAssert, and WizardSignature.

Referenced by SetAuthenticateKeyLength().

WizardExport void SetSecretPassphrase | ( | SecretInfo * | secret_info,
|  | const char * | passphrase |
| ) |  |  |

References ConstantString(), DestroyString(), and _SecretInfo::passphrase.

Referenced by SetAuthenticatePassphrase().