代码

头文件

#ifndef RSA_H
#define RSA_H#include <QDebug>
#include <openssl/rsa.h>
#include <openssl/pem.h>
#include<openssl/bio.h>
#include <openssl/err.h>
// define rsa public key
#define BEGIN_RSA_PUBLIC_KEY    "BEGIN RSA PUBLIC KEY"      //
#define BEGIN_PUBLIC_KEY        "BEGIN PUBLIC KEY"          // 公钥头部
#define KEY_LENGTH              1024                        // 密钥长度class rsa
{public:rsa();// 生成一对公钥和私钥static bool MakeUpRsaKey (QString& publicKey, QString& privateKey);/*** @brief rsa_pri_encrypt 私钥加密* @param strClearData 明文* @param strPriKey 私钥* @return 加密后数据(base64格式)*/static QString rsa_pri_encrypt_base64 (const QString& strClearData, const QString& strPriKey);/*** @brief rsa_pub_decrypt 公钥解密* @param strDecrypt 待解密数据(base64格式)* @param strPubKey 公钥钥* @return 明文*/static QString rsa_pub_decrypt_base64 (const QString& strDecryptData, const QString& strPubKey);/*** @brief rsa_pub_encrypt 公钥加密* @param strClearData 明文* @param strPubKey 私钥* @return 加密后数据(base64格式)*/static QString rsa_pub_encrypt_base64 (const QString& strClearData, const QString& strPubKey);/*** @brief rsa_pri_decrypt 私钥解密* @param strDecrypt 待解密数据(base64格式)* @param strPriKey 私钥* @return 明文*/static QString rsa_pri_decrypt_base64 (const QString& strDecryptData, const QString& strPriKey);// 签名 strData 原始字符串;  strSigned 签名结果 ; strPriKey 私钥static bool RSASignAction( char *str, QString &strSigned, const char *pri);// 验签  strData 原始字符串; strSigned 待验签字符串 ;strPubKey 公钥static bool RSAVerAction(QString strData,QString &strSigned,QString & strPubKey);/**< 测试 */static void test ();};#endif // RSA_H

源文件

#include "rsa.h"// 转换为base64格式输出
int Base64Encode(unsigned char *plaintext, size_t plainlen, char *ciphertext,size_t *cipherlen)
{if (!ciphertext){*cipherlen = (plainlen + 2) / 3 * 4;return 0;}int nLen = EVP_EncodeBlock((unsigned char *)ciphertext, (const unsigned char *)plaintext,(int)plainlen);if (nLen < 0){return -2;}*cipherlen = nLen;return 0;
}rsa::rsa()
{}
bool rsa::MakeUpRsaKey (QString& strPubKey, QString& strPriKey)
{RSA *pRsa = RSA_generate_key(KEY_LENGTH, RSA_3, NULL, NULL);if ( !pRsa ){return false;}BIO *pPriBio = BIO_new(BIO_s_mem());PEM_write_bio_RSAPrivateKey(pPriBio, pRsa, NULL, NULL, 0, NULL, NULL);BIO *pPubBio = BIO_new(BIO_s_mem());PEM_write_bio_RSAPublicKey(pPubBio, pRsa);// 获取长度size_t nPriKeyLen = BIO_pending(pPriBio);size_t nPubKeyLen = BIO_pending(pPubBio);// 密钥对读取到字符串char* pPriKey = new char[nPriKeyLen];char* pPubKey = new char[nPubKeyLen];BIO_read(pPriBio, pPriKey, nPriKeyLen);BIO_read(pPubBio, pPubKey, nPubKeyLen);// 存储密钥对strPubKey = QByteArray(pPubKey, nPubKeyLen);strPriKey = QByteArray(pPriKey, nPriKeyLen);// 内存释放RSA_free(pRsa);BIO_free_all(pPriBio);BIO_free_all(pPubBio);delete pPriKey;delete pPubKey;return true;
}/*** @brief rsa_pri_encrypt 私钥加密* @param strClearData 明文* @param strPriKey 私钥* @return 加密后数据(base64格式)*/
QString rsa::rsa_pri_encrypt_base64 (const QString& strClearData, const QString& strPriKey)
{QByteArray priKeyArry = strPriKey.toUtf8();uchar* pPriKey = (uchar*)priKeyArry.data();BIO* pKeyBio = BIO_new_mem_buf(pPriKey, strPriKey.length());if (pKeyBio == NULL){return "";}RSA* pRsa = RSA_new();pRsa = PEM_read_bio_RSAPrivateKey(pKeyBio, &pRsa, NULL, NULL);if ( pRsa == NULL ){BIO_free_all(pKeyBio);return "";}int nLen = RSA_size(pRsa);char* pEncryptBuf = new char[nLen];memset(pEncryptBuf, 0, nLen);QByteArray clearDataArry = strClearData.toUtf8();int nClearDataLen = clearDataArry.length();uchar* pClearData = (uchar*)clearDataArry.data();int nSize = RSA_private_encrypt(nClearDataLen,pClearData,(uchar*)pEncryptBuf,pRsa,RSA_PKCS1_PADDING);QString strEncryptData = "";if ( nSize >= 0 ){QByteArray arry(pEncryptBuf, nSize);strEncryptData = arry.toBase64();}// 释放内存delete pEncryptBuf;BIO_free_all(pKeyBio);RSA_free(pRsa);return strEncryptData;
}/*** @brief rsa_pub_decrypt 公钥解密* @param strDecrypt 待解密数据(base64格式)* @param strPubKey 公钥* @return 明文*/
QString rsa::rsa_pub_decrypt_base64(const QString& strDecryptData, const QString& strPubKey)
{QByteArray pubKeyArry = strPubKey.toUtf8();uchar* pPubKey = (uchar*)pubKeyArry.data();BIO* pKeyBio = BIO_new_mem_buf(pPubKey, strPubKey.length());if (pKeyBio == NULL){qDebug()<<"error 1";return "";}RSA* pRsa = RSA_new();if ( strPubKey.contains(BEGIN_RSA_PUBLIC_KEY) ){pRsa = PEM_read_bio_RSAPublicKey(pKeyBio, &pRsa, NULL, NULL);}else{pRsa = PEM_read_bio_RSA_PUBKEY(pKeyBio, &pRsa, NULL, NULL);}if ( pRsa == NULL ){BIO_free_all(pKeyBio);qDebug()<<"error 2";return "";}int nLen = RSA_size(pRsa);char* pClearBuf = new char[nLen];memset(pClearBuf, 0, nLen);//解密QByteArray decryptDataArry = strDecryptData.toUtf8();decryptDataArry = QByteArray::fromBase64(decryptDataArry);int nDecryptDataLen = decryptDataArry.length();uchar* pDecryptData = (uchar*)decryptDataArry.data();int nSize = RSA_public_decrypt(nDecryptDataLen,pDecryptData,(uchar*)pClearBuf,pRsa,RSA_PKCS1_PADDING);QString strClearData = "";if ( nSize >= 0 ){strClearData = QByteArray(pClearBuf, nSize);}// 释放内存delete pClearBuf;BIO_free_all(pKeyBio);RSA_free(pRsa);return strClearData;
}/*** @brief rsa_pub_encrypt 公钥加密* @param strClearData 明文* @param strPubKey 私钥* @return 加密后数据(base64格式)*/
QString rsa::rsa_pub_encrypt_base64 (const QString& strClearData, const QString& strPubKey)
{QByteArray pubKeyArry = strPubKey.toUtf8();uchar* pPubKey = (uchar*)pubKeyArry.data();BIO* pKeyBio = BIO_new_mem_buf(pPubKey, pubKeyArry.length());if (pKeyBio == NULL){return "";}RSA* pRsa = RSA_new();if ( strPubKey.contains(BEGIN_RSA_PUBLIC_KEY) ){pRsa = PEM_read_bio_RSAPublicKey(pKeyBio, &pRsa, NULL, NULL);}else{pRsa = PEM_read_bio_RSA_PUBKEY(pKeyBio, &pRsa, NULL, NULL);}if ( pRsa == NULL ){BIO_free_all(pKeyBio);return "";}int nLen = RSA_size(pRsa);char* pEncryptBuf = new char[nLen];memset(pEncryptBuf, 0, nLen);QByteArray clearDataArry = strClearData.toUtf8();int nClearDataLen = clearDataArry.length();uchar* pClearData = (uchar*)clearDataArry.data();int nSize = RSA_public_encrypt(nClearDataLen,pClearData,(uchar*)pEncryptBuf,pRsa,RSA_PKCS1_PADDING);QString strEncryptData = "";if ( nSize >= 0 ){QByteArray arry(pEncryptBuf, nSize);strEncryptData = arry.toBase64();}// 释放内存delete pEncryptBuf;BIO_free_all(pKeyBio);RSA_free(pRsa);return strEncryptData;
}/*** @brief rsa_pri_decrypt 私钥解密* @param strDecrypt 待解密数据(base64格式)* @param strPriKey 私钥* @return 明文*/
QString rsa::rsa_pri_decrypt_base64(const QString& strDecryptData, const QString& strPriKey)
{QByteArray priKeyArry = strPriKey.toUtf8();uchar* pPriKey = (uchar*)priKeyArry.data();BIO* pKeyBio = BIO_new_mem_buf(pPriKey, priKeyArry.length());if (pKeyBio == NULL){return "";}RSA* pRsa = RSA_new();pRsa = PEM_read_bio_RSAPrivateKey(pKeyBio, &pRsa, NULL, NULL);if ( pRsa == NULL ){BIO_free_all(pKeyBio);return "";}int nLen = RSA_size(pRsa);char* pClearBuf = new char[nLen];memset(pClearBuf, 0, nLen);//解密QByteArray decryptDataArry = strDecryptData.toUtf8();decryptDataArry = QByteArray::fromBase64(decryptDataArry);int nDecryptDataLen = decryptDataArry.length();uchar* pDecryptData = (uchar*)decryptDataArry.data();int nSize = RSA_private_decrypt(nDecryptDataLen,pDecryptData,(uchar*)pClearBuf,pRsa,RSA_PKCS1_PADDING);QString strClearData = "";if ( nSize >= 0 ){strClearData = QByteArray(pClearBuf, nSize);}// 释放内存delete pClearBuf;BIO_free_all(pKeyBio);RSA_free(pRsa);return strClearData;
}void rsa::test()
{/**< rsa private/public key 若从文件中拷贝出来,需要注意保存元先文件格式,即换行符需要带上,包括最后一行的换行符 *///QString strPriKey = "";// QString strPubKey = "";/***  用代码生成的key与openssl命令生成的key区别:*  1、代码生成key,标题为 -----BEGIN RSA PUBLIC KEY-----,openssl命令生成key, 标题为 -----BEGIN PUBLIC KEY-----*  2、获取RSA函数不同,代码生成key,用PEM_read_bio_RSAPublicKey,openssl命令生成key,用PEM_read_bio_RSA_PUBKEY*///MakeUpRsaKey(strPubKey, strPriKey);//qDebug() << strPubKey << endl;//qDebug() << strPriKey << endl;/*strPubKey = QString("-----BEGIN PUBLIC KEY-----\n")+QString("MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCbXcFx8TIEnRjS9H+KxapUBI6r\n") +QString("QO8ZeeZKDpa1V/lUg7FsUOdhfjze8YkL2F1et0zSjK7YeQPjWO8NDg7/TTLfpW27\n")+QString("krhkreYFQ9Y4vHrCKhjc3DD+Yzy9wyKKn5O9M9qU0Kzu8ads/mrPe82/xoo/XDv2\n") +QString("eTR755MEi1BO+S1RLQIDAQAB\n")+QString("-----END PUBLIC KEY-----");strPriKey = QString("-----BEGIN PRIVATE KEY-----\n")+QString("MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAJtdwXHxMgSdGNL0\n") +QString("f4rFqlQEjqtA7xl55koOlrVX+VSDsWxQ52F+PN7xiQvYXV63TNKMrth5A+NY7w0O\n") +QString("Dv9NMt+lbbuSuGSt5gVD1ji8esIqGNzcMP5jPL3DIoqfk70z2pTQrO7xp2z+as97\n") +QString("zb/Gij9cO/Z5NHvnkwSLUE75LVEtAgMBAAECgYBkwqY9hkaBFX1O+wBoeI9hk98P\n") +QString("E7q9VABVUSbOjzKFbC855zJYWS2TDSRrSTQsxEYPWuveOoWaAUhvuAlj66YswIL6\n") +QString("BRgA20eoDr34w+1GABXbFSrP2L1rR2v0qEdiSPsACI0aAmZGO4eq+Fns+EuJ0KSg\n") +QString("FIZmv3rJV7Nhd9aTQQJBAMmpvcCjxVLfTfiT52j6FDTpAMmd5e832EUEWdzAIzh7\n") +QString("Z57vsmR7eGbp+9kiRl3eZMOPg2wdfkXvHUrmQK0F/p0CQQDFOpCs75lIVufTZKDU\n") +QString("7tMQXr4Tzc8EJPaeBuSDXey5okek+ntq55C3xo8nEgDtaVP6mcLqpZR/s+6PjChb\n") +QString("rk/RAkBzQ7z8pd78Xjx/z3Iec4onL+LOWpz5XW8VC8adQYkgGJECrDjH7DbGhAj6\n") +QString("c/fKYXowuQ/CNR1etayFihP/kYSVAkB0sxSL3zG5hgKiKHapx66Hjye1HCAT+bMb\n") +QString("CkUIHflGVelCixufw+jzdL+bhKGb2KjiLT0SDmtxrIvJ0ErJBLkhAkEAj8Yh3H+W\n") +QString("OWauml/oVqNTbCKttV6irPYVUJkcJnnByjWxVP2I7hmJNuxNAKsNjR204IMsMaWh\n") +QString("qbByj4ywB5LieQ==\n")+QString("-----END PRIVATE KEY-----");*//* qDebug() << "useing publicKey to Encrypt and privateKey Decrypt:";QString strClear = "hello334344554 WORLD12W2WDWDEDWDD";qDebug() << "after publicKey Encrypt:";QString strEncryptData = rsa_pub_encrypt_base64 (strClear, strPubKey);qDebug() << strEncryptData;qDebug()<<  "after privateKey Decrypt:";QString strClearData = rsa_pri_decrypt_base64 (strEncryptData, strPriKey);qDebug() << strClearData;*/// 现在进行签名测试,使用私钥签名,公钥验签QString priKey = QString("-----BEGIN PRIVATE KEY-----\n")+QString("MIICeAIBADANBgkqhkiG9w0BAQEFAASCAmIwggJeAgEAAoGBAJQOMmftEDgwvnM3\n") +QString("PKWbvF+xvSGLVaJYySSQtmKczEE2ufYR2LM2qwsZhBUwzW+ssKGVrCsjmmI5G4oF\n") +QString("gcVsa3uA221c6oDaERvQYrFNN9KaLNrIdEA1Nh0MTAg5M6AK2wTHnPH5DGrVXtGs\n") +QString("k6ZLTuKUjpR8iWMMc+0C5ApG3ssLAgMBAAECgYAEiLbEdf8UKXH7p0plK/LF33SS\n") +QString("TWkO8rceNoxPUsvyh1GElqFTQ65TRbHE0FzKObijCilenNWCgos0W9zQhfR4pLkJ\n") +QString("jZyv+W4xJ3qAH7drzcd2MgBP1v91gJK6VPjD+J0pNACF1xGLsFBZmWIbFATDU38z\n") +QString("3SbTPVS15oPXgDdEwQJBAOF2v+skafKdtKmLgy3Hna+iA+uNNUZ7q8bQyjY4nviV\n") +QString("FRL3MBgugIpUYaiiCzhl8BZftoB6pg0DCBOlQxONgiECQQCoG43bGjM0uh7e8cMT\n") +QString("45OJDruii7wQnpJuZZH67qOGtnZA/coYDGArqFwmrQz2nQJGwePvNt4kT3Ibighf\n") +QString("ev+rAkEAtuXKEkpb2ACvCcqvA3gnJs7bNz45tY+lbYb6Qrnz29u0WMpFLZirlYuW\n") +QString("HWI2j+3BsaS7O8ZC5dNLvgQWQcpNgQJBAJwm3CIFuELmD/7ve1FiN408TjayrcKS\n") +QString("SVqapnr8aJGds0Kze6HS/RIQlWinnj8FoTOwrtVplfcMhOXn1dc7HXkCQQCRu9UN\n") +QString("4mMrQLLg7S88fbjxsy7+cuELxBNrix3GU8F6EAtWWq2e1EaUu0VVtRq7f/IKPdKD\n") +QString("uEBxsPfr/EXy6yDw\n")+QString("-----END PRIVATE KEY-----");QString pbKey = QString("-----BEGIN PUBLIC KEY-----\n")+QString("MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCUDjJn7RA4ML5zNzylm7xfsb0h\n") +QString("i1WiWMkkkLZinMxBNrn2EdizNqsLGYQVMM1vrLChlawrI5piORuKBYHFbGt7gNtt\n")+QString("XOqA2hEb0GKxTTfSmizayHRANTYdDEwIOTOgCtsEx5zx+Qxq1V7RrJOmS07ilI6U\n") +QString("fIljDHPtAuQKRt7LCwIDAQAB\n")+QString("-----END PUBLIC KEY-----");QString aaa = "SZHAILEI88123456&111122334";QString ret="";rsa::RSASignAction(aaa,ret,priKey);qDebug()<<"after =========> "<<ret;bool flag = rsa::RSAVerAction(aaa,ret,pbKey);if(flag){qDebug()<<"@@@@@@@@@@ success !";}else{qDebug()<<"@@@@@@@@@ failed !";}
}bool rsa::RSASignAction(QString strData, QString &strSigned,QString &strPriKey)
{qDebug()<<"now rsa sign";QByteArray clearDataArry = strData.toUtf8();int len = clearDataArry.length();QByteArray priKeyArry = strPriKey.toUtf8();uchar* pPriKey = (uchar*)priKeyArry.data();BIO* pKeyBio = BIO_new_mem_buf(pPriKey, strPriKey.length());if (pKeyBio == NULL){return false;}RSA* prsa = NULL;prsa = PEM_read_bio_RSAPrivateKey(pKeyBio, &prsa, NULL, NULL);if ( prsa == NULL ){BIO_free_all(pKeyBio);return false;}unsigned char szTmp[1024] = {0};SHA256((const unsigned char*)clearDataArry.data(),len,szTmp);int nlen = 0;unsigned int nlenRet = 0;char szTmp1[1024] = {0};nlen  = RSA_sign(NID_sha256,szTmp,SHA256_DIGEST_LENGTH,(unsigned char*)szTmp1,&nlenRet,prsa);if(nlen!=1){RSA_free(prsa);BIO_free_all(pKeyBio);return false;}QByteArray  arry = QByteArray(szTmp1);strSigned = QString(arry.toBase64());BIO_free_all(pKeyBio);RSA_free(prsa);return true;
}bool rsa::RSAVerAction( char *str, QString &strSigned, const char *pri)
{int  len = strlen(str);BIO* pKeyBio = BIO_new_mem_buf(pri, strlen(pri));if (pKeyBio == NULL){return false;}RSA* prsa = NULL;prsa = PEM_read_bio_RSAPrivateKey(pKeyBio, &prsa, NULL, NULL);if ( prsa == NULL ){BIO_free_all(pKeyBio);return false;}unsigned char szTmp[1024] = {0};SHA256((const unsigned char*)str,len,szTmp);int nlen = 0;unsigned int nlenRet = 0;unsigned char szTmp1[1024] = {0};nlen  = RSA_sign(NID_sha256,szTmp,SHA256_DIGEST_LENGTH,szTmp1,&nlenRet,prsa);if(nlen!=1){RSA_free(prsa);BIO_free_all(pKeyBio);return false;}size_t plainlen = 0;uint8_t plaintext[1024]={0};Base64Encode(szTmp1,nlenRet,(char*)plaintext,&plainlen);strSigned = QString("%1").arg((char*)plaintext);BIO_free_all(pKeyBio);RSA_free(prsa);return true;
}

QT 中使用 rsa 加密 签名相关推荐

  1. 在ASP.Net中实现RSA加密

    在我们实际运用中,加密是保证数据安全的重要手段.以前使用ASP时,对数据加密可以使用MD5和SHA1算法,这两种算法虽然快捷有效,但是无法对通过它们加密的密文进行反运算,即是解密.因此需要解密数据的场 ...

  2. Android+Java中使用RSA加密实现接口调用时的校验功能

    场景 RSA加密 RSA算法是一种非对称加密算法,那么何为非对称加密算法呢? 一般我们理解上的加密是这样子进行的:原文经过了一把钥匙(密钥)加密后变成了密文,然后将密文传递给接收方,接收方再用这把钥匙 ...

  3. java ios 字符串_Java 与 iOS使用RSA 加密签名

    RSA算法是一种非对称加密算法,常被用于加密数据传输.如果配合上数字摘要算法, 也可以用于文件签名. 本文将讨论如何在iOS中使用RSA传输加密数据. 本文环境 mac os openssl-1.0. ...

  4. 学习笔记——RSA加密签名

    前后端请求,内容涉及用户信息时一般会要求对数据进行加密:对于支付系统的接口,为了保证参数不被篡改(如订单金额.支付单号等),需要对下单参数进行签名: 本篇介绍RSA相关的知识以及应用场景,包括:对称加 ...

  5. python rsa加密二进制文件_用Python中的RSA加密文件

    公钥密码通常只用于少量数据.它很慢,很难正确使用.通常的做法是使用其他方法将非对称问题减少到由共享密钥提供安全性的问题,然后使用公钥加密来保护该共享密钥.例如:要加密文件,随机生成块或流密码(例如AE ...

  6. PL/SQL中的RSA加密

    目录 介绍 背景 使用代码 兴趣点 如何在Oracle 11g PL / SQL软件包(带有某些JAVA帮助器)中使用RSA公钥加密数据 介绍 最近,我需要使用提供的RSA公钥从Oracle PL / ...

  7. 在ASP中实现RsA加密与解密

    本文章有两文件组成 test.asp 测试演示文件 clsrsa.asp 实现rsa加密与解密的vbs类文件 下面是代码: 1. test.asp <% rem 文章标题:在asp中通过vbs类 ...

  8. 隐私计算加密技术基础系列(中)-RSA加密解析

    1 隐私计算基座-密码学 1.1 隐私计算背景 隐私计算(Privacy-preserving computation)是指在保证数据提供方不泄露原始数据的前提下,对数据进行分析计算的一系列信息技术, ...

  9. python中使用rsa加密

    前提不多说, 为什么使用RSA加密请自行搜索,直接正为: 一. 生成公钥及私钥, 并保存 二. 使用公钥加密, 私钥解密 后记: 通常使用中, 会先对数据进行bas64加密, 再对加密后的内容使用rs ...

最新文章

  1. Simple DNS Plus 5.2 build 117
  2. 开发小技巧之:unicode的排序和正则匹配
  3. Java反射-静态/动态加载类
  4. cortex M0 典型os模型
  5. centos7安装xterm_CentOS 7使用x-manager中Xstart工具报缺少xterm包错误
  6. 简哲,请让我的生活简单一点。——批《输入法破局研究——联盟推广》
  7. 经典算法题每日演练——第二十四题 梳排序
  8. HDU - 1757 A Simple Math Problem (矩阵快速幂)
  9. 为什么看别人的网站排名都在第一页?有可能是以下三种原因
  10. Deep manta算法解析
  11. pythonATM,购物车项目实战_补充9文档说明
  12. 【图像隐写】基于matlab DWT数字水印多种攻击效果对比【含Matlab源码 1134期】
  13. Hbase安装教程详解
  14. Linux网络下载管理工具(lftp, ftp, lftpget, wget)
  15. 实验三 大数据可视化工具—ECharts
  16. WINDOWS2008 SERVER服务器上网实战
  17. 2021-07-26记录字节“懂车帝”重庆岗一面(绝对凉)
  18. 腾讯T3亲自讲解!2021年最新Android面试点梳理,附带学习经验
  19. python连乘函数_python 连乘
  20. php windows 信号,win10连接投影仪无信号怎么办

热门文章

  1. 什么?你正在学web自动化测试?那这些Selenium的基本操作你了解过嘛?
  2. 【渝粤教育】国家开放大学2019年春季 1025保险学概论 参考试题
  3. 每日linux——网络命令2
  4. 关于解决WIN8系统下QT5.6编译报错的问题
  5. 用MongoDB分析合肥餐饮业
  6. 必备画图技能:流程图
  7. matlab构建一个神经网络,matlab构建神经网络
  8. canvas绘图基础整理
  9. 分享105个软件测试工具 (免费试用) 赶快收藏起来,日后必定有用~
  10. ARM——cortex-A7核 按键中断实验