91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 956KB
    文件類型: .gz
    金幣: 1
    下載: 0 次
    發布日期: 2021-05-24
  • 語言: 其他
  • 標簽: QT4??QCA??加密庫??

資源簡介

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]?< ????//?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? ????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

評論

共有 條評論