AuroraRuntime/Source/Crypto/CBC/CBC.hpp

31 lines
860 B
C++
Raw Normal View History

/***
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: CBC.hpp
Date: 2022-10-08
Author: Reece
***/
#pragma once
namespace Aurora::Crypto::CBC
{
struct CBCContext : ICBCContext
{
bool Initialize(const Memory::MemoryViewRead &key,
const Memory::MemoryViewRead &iv) override;
bool GetIV(const Memory::MemoryViewWrite &writeView) override;
bool SetIV(const Memory::MemoryViewRead &readView) override;
bool TryInit(int iCipher);
bool Decrypt(int iCipher, const Memory::MemoryViewWrite &memoryView);
bool Encrypt(int iCipher, const Memory::MemoryViewWrite &memoryView);
private:
symmetric_CBC cbc_ {};
char streamKey_[32];
int iKeyLength {};
int iIVLength {};
int iLastCipher_ { -1 };
};
}