资源简介
QT4 QCA 加密库
QCA is a library that provides an easy API for a range of cryptographic
features, including SSL/TLS, X.509 certificates, SASL, OpenPGP, smartcards,
and much more.
代码片段和文件信息
/*
Copyright (C) 2006 Brad Hards
Permission is hereby granted free of charge to any person obtaining a copy
of this software and associated documentation files (the “Software“) to deal
in the Software without restriction including without limitation the rights
to use copy modify merge publish distribute sublicense and/or sell
copies of the Software and to permit persons to whom the Software is
furnished to do so subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS“ WITHOUT WARRANTY OF ANY KIND EXPRESS OR
IMPLIED INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM DAMAGES OR OTHER LIABILITY WHETHER IN
AN ACTION OF CONTRACT TORT OR OTHERWISE ARISING FROM OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
// QtCrypto has the declarations for all of QCA
#include
#include
#include
#ifdef QT_STATICPLUGIN
#include “import_plugins.h“
#endif
class AESCMACContext : public QCA::MACContext
{
public:
AESCMACContext(QCA::Provider *p) : QCA::MACContext(p “cmac(aes)“)
{
}
~AESCMACContext()
{
}
// Helper to left shift an arbitrary length array
// This is heavily based on the example in the I-D.
QCA::SecureArray leftShift(const QCA::SecureArray &array)
{
// We create an output of the same size as the input
QCA::SecureArray out(array.size());
// We handle one byte at a time - this is the high bit
// from the previous byte.
int overflow = 0;
// work through each byte.
for (int i = array.size() -1; i >= 0; --i) {
// do the left shift on this byte.
out[i] = array[i] << 1;
// make the low bit on this byte be the high bit
// from the previous byte.
out[i] |= overflow;
// save the high bit for next time
overflow = (array[i] & 0x80) ? 1 : 0;
}
return out;
}
// Helper to XOR two arrays - must be same length
QCA::SecureArray xorArray(const QCA::SecureArray &array1
const QCA::SecureArray &array2)
{
if (array1.size() != array2.size())
// empty array
return QCA::SecureArray();
QCA::SecureArray result(array1.size());
for (int i = 0; i < array1.size(); ++i)
result[i] = array1[i] ^ array2[i];
return result;
}
void setup(const QCA::SymmetricKey &key)
{
// We might not have a real key since this can get called
// from the constructor.
if (key.size() == 0)
return;
m_key = key;
// Generate the subkeys
QCA::SecureArray const_Zero(16);
QCA::SecureArray const_Rb(16);
const_Rb[15] = (char)0x87;
m_X = const_Zero;
m_residual = QCA::SecureArray();
// Figure 2.2 step 1.
QCA::Cipher aesObj(QString(“aes128“)
QCA::Ciphe
相关资源
- QT4编写的简单计算器
- QCA9531_AP147参考电路原理图.pdf
- 用Qt5实现QCamera摄像头的调用和监控
- QCamera 简单使用
- SlidingWindow
- Qt4图片缩放应用程序
-
QT4 xm
l与QTableWidget的结合,QTableWid - QCA9886 datasheet
- linux的Qt设置系统时间
- Qt4.8.2 模仿QQ桌面右下角消息提示
- QJson使用VS2010+QT4.8编译
- QT 二维数组成图
- PyQt4入门指南 PDF中文版
- Qt4迁移至Qt5完全指南
- 电力猫QCA6410 成品电路图.pdf
- 高通电力猫PLC QCA6410 芯片资料(Data
- qca-qt5lib
- STM32 X-CUBE-CRYPTOLIB V3.1.0 Patch V3.1.2
- QT4环境下,触摸屏软键盘代码Qt4Soft
- lzma-4.32.tar.bz2
- QT4.5简单中文输入法原创
- 高通 PLC载波通讯QCA7500资料等
- QtCharts_dev_for_Qt4.8.6.zip
- qca9533 9531固件提取art无线驱动
- 基于QCA9533自研路由器的openwrt软件移植
- QCA7500_datasheet.pdf
- Qualcomm-Atheros-QCA9377-Wifi-Linux驱动
- Qualcomm-Atheros-QCA9377-Wifi-Linux.rar
- QCAD 的DXFlib手册
- Qt4摄像头视频采集
评论
共有 条评论