Reece Wilson
d63571e4b5
[+] AuCrypto::CBC::CBCContext [+] AuFS::ReadDirRecursive [+] AuFS::DirDeleter [+] AuCrypto::PBKDF2 [+] AuCrypto::AES::CBCEncrypt [+] AuCrypto::AES::CBCDecrypt [+] AuCrypto::TDES::CBCEncrypt [+] AuCrypto::TDES::CBCDecrypt [+] Optimize read write locks [*] Added `ContextFlags = CONTEXT_ALL` to Win32 PlatformWalkCallStack
59 lines
2.1 KiB
C++
59 lines
2.1 KiB
C++
/***
|
|
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
|
|
|
File: AES.hpp
|
|
Date: 2021-6-11
|
|
Author: Reece
|
|
***/
|
|
#pragma once
|
|
|
|
namespace Aurora::Crypto::AES
|
|
{
|
|
/**
|
|
* @brief
|
|
* @param pContext
|
|
* @param memoryView
|
|
* @return
|
|
*/
|
|
AUKN_SYM bool CBCEncrypt(const AuSPtr<CBC::ICBCContext> pContext,
|
|
const Memory::MemoryViewWrite &memoryView);
|
|
|
|
/**
|
|
* @brief
|
|
* @param pContext
|
|
* @param memoryView
|
|
* @return
|
|
*/
|
|
AUKN_SYM bool CBCDecrypt(const AuSPtr<CBC::ICBCContext> pContext,
|
|
const Memory::MemoryViewWrite &memoryView);
|
|
|
|
/**
|
|
* @brief
|
|
* @param plainText
|
|
* @return
|
|
*/
|
|
AUKN_SYM AuUInt GetSafeCipherPadding(const Memory::MemoryViewRead &plainText);
|
|
|
|
// Remember: AES works in chunks of 128 bits
|
|
// IVS are 16 bytes long
|
|
// Chunks are 16 bytes long
|
|
// Keys are 16, 24, or 32 bytes long
|
|
// Initialization vectors must never be constant
|
|
// Initialization vectors should be determined by a handshaake
|
|
// It is not the end of the world if an IV is made public by design
|
|
// Keys must be random
|
|
// Initialization vectors could be derived from SHA1, Tiger, or SHA2 digests
|
|
AUKN_SYM bool Encrypt(const Memory::MemoryViewRead &plainText,
|
|
const Memory::MemoryViewRead &inIv,
|
|
const Memory::MemoryViewWrite &outIv, // optional
|
|
const Memory::MemoryViewRead &inKey,
|
|
Memory::ByteBuffer &out,
|
|
bool auCoolCodePadding);
|
|
|
|
AUKN_SYM bool Decrypt(const Memory::MemoryViewRead &cipherText,
|
|
const Memory::MemoryViewRead &inIv,
|
|
const Memory::MemoryViewWrite &outIv, // optional
|
|
const Memory::MemoryViewRead &inKey,
|
|
Memory::ByteBuffer &plainText,
|
|
bool auCoolCodePadding);
|
|
} |