资源简介
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
相关资源
- Mini6410 Qt4和Qtopia编程开发指南
- Qt 日历可显示阴历生宵和时钟基于Q
- 使用Qt编写的视频监控系统支持Qt4-Q
- 仿qq界面 qt
- QCA9531固件带USB支持
- QCA9563 datasheet
- Qt类关系图
- QT4.6实践编写串口调试助手原创全源码
- QT4简洁音乐播放器
- [嵌入式Linux项目实战开发]基于QT4.7.
- qca wifi-10.2源代码用户手册
- stm32-cryp-lib(STM32 芯片加密库)
- Qt4编写简单的计算器
- Qt4~实现音乐播放器~完整
- qt 学生成绩管理系统完整版
- QCA8075HWUserReference.zip
- 局域网简易聊天室+基于QT4.8.3+源码
- Qt4闹钟
- QCA9531全套资料DATASHEET+SCH+PCB
- QT4.8做的五彩贪吃蛇游戏
- QT4 设置字体
- 零基础学QT4编程.pdf
- qt4-24小时学会教程.
- 视频播放 Qt 4
- 非常详细的QT4教程
- QCA9563_高通原厂原理图
- QCA8334 datasheet
- Qt4 图形设计与嵌入式开发 高清完整版
- 高通QCA9531 芯片资料
- PyQt4 参考手册
评论
共有 条评论