问题标签 [libgcrypt]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
c++ - Mac OS C/C++ 包含问题
我最近从 Gnu 安装了 libgcrypt,但即使将它放在我的 /usr/include 和 /usr/local/include 目录中,我也无法编译包含它的 C++ 文件。尽管我将它放在正确的文件夹中,但它似乎无法找到该文件。任何想法将不胜感激。
c++ - 如何使用 GPLv2 兼容库从文件中读取 RSA 私钥?
我需要做一些 RSA 解密,我的私钥存储在一个文件中。我正在使用 C++。起初我使用 OpenSSL,它运行顺利,但随后出现了许可问题,因为我希望我的代码与 GPLv2 兼容。现在我正在尝试使用 libgcrypt,但我在使用 S 表达式时遇到了问题。这是我的代码:
现在,我知道这绝对不是使用 libgcrypt 的正确方法(因为我正在将整个密钥文本作为 MPI 读取,并且解密失败),但是在前面的手册中,我找不到读取密钥的方法。 ..我应该手动解析密钥吗?
谢谢!
cryptoapi - BcryptSignHash 输出签名的字节序
BcryptGenerateKeyPair生成的私钥和公钥 blob采用大端编码 ( http://msdn.microsoft.com/en-us/library/windows/desktop/aa375520%28v=vs.85%29.aspx )。
使用这些密钥,我使用BcryptSignHash对数据进行签名并生成一个 64 字节的签名,理想情况下应该是 (r,s)。这个签名也是大端编码的吗?
我需要这些信息来从 64 字节签名中提取 r 和 s。我假设 64 字节签名是 r(前 32 个字节)和 s(后 32 个字节)的串联。
如果错了请纠正我
c++ - libgcrypt 中的 AES128 未加密
我一直在为我的一个小型加密项目尝试 libgcrypt,但我似乎无法正确实现加密/解密。以下是类及其用法。
我在这样的主要功能中使用它:
输出是
奇怪的是,我用几乎完全相同的语句制作了一个测试程序,并且运行良好。当我试图将它打包成一个类时,它开始分崩离析。下面是这个程序的代码,如果有人想看的话。
visual-c++ - libgcrypt.lib 中未解析的外部符号
如果我在 .lib(library) 文件中发现未解析的外部符号,我必须做什么。如果我在 .c 或 .cpp 中发现未解析的外部符号,我可以修复它。但是当我在 .lib(library) 文件中发现 Unresolved external symbol 时,我该如何解决这个问题?
就我而言,我发现了这样的链接器错误:
错误 1 错误 LNK2019:未解析的外部符号 ___mingw_vfprintf 在函数 _fprintf D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt.lib(libgcrypt_la-global.o) 中引用 错误 2 错误 LNK2001:未解析的外部符号 ___mingw_vfprintf D:\VidPlaya_offline TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt.lib(libgcrypt_la-misc.o) 错误 3 错误 LNK2001: 无法解析的外部符号 _gpg_strerror D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt.lib(ecc.4)错误 LNK2019:函数 __gcry_strerror D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt 中引用了无法解析的外部符号 _gpg_strerror。lib(libgcrypt_la-global.o) 错误 5 错误 LNK2001: 无法解析的外部符号 _gpg_strerror D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt.lib(libgcrypt_la-misc.o) 错误 6 错误 LNK2001: 无法解析的外部符号 _gpg_strerror D :\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt.lib(md.o) 错误 7 错误 LNK2001: 无法解析的外部符号 _gpg_strerror D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt. o) 错误 8 错误 LNK2019:未解析的外部符号 _gpg_strsource 在函数 __gcry_strsource D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt 中引用。lib(libgcrypt_la-global.o) 错误 9 错误 LNK2019:未解析的外部符号 _gpg_err_set_errno 在函数 _do_malloc D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt.lib(libgcrypt_la-global.o) 错误 10 错误 LNK2001 中引用:unresolved external symbol _gpg_err_set_errno D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt.lib(libgcrypt_la-stdmem.o) Error 11 error LNK2001: unresolved external symbol _gpg_err_set_errno D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt. lib(libgcrypt_la-secmem.o) 错误 12 错误 LNK2001:无法解析的外部符号 _gpg_err_code_from_errno D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt.lib(libgcrypt_la-module.o) Error 13 error LNK2019: unresolved external symbol _gpg_err_code_from_errno referenced in function _gpg_err_make_from_errno D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt.lib (libgcrypt_la-global.o) 错误 14 错误 LNK2001: 无法解析的外部符号 _gpg_err_code_from_errno D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt.lib(libgcrypt_la-sexp.o) 错误 15 错误 LNK2001: 无法解析的外部符号 r_pger_from_d: \VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt.lib(md.o) 错误 16 错误 LNK2001:unresolved external symbol _gpg_err_code_from_errno D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt.lib(primegen.o) Error 17 error LNK2019: unresolved external symbol ___mingw_vsprintf referenced in function _sprintf D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore \libgcrypt.lib(libgcrypt_la-sexp.o) Error 18 error LNK2001: unresolved external symbol ___mingw_vsprintf D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt.lib(ac.o) Error 19 error LNK2001: unresolved external symbol _gpg_errsyserror_code D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt.lib(primegen.o) 错误 20 错误 LNK2019:unresolved external symbol _gpg_err_code_from_syserror referenced in function _progress D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt.lib(dsa.o) Error 21 error LNK2001: unresolved external symbol _gpg_err_code_from_syserror D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore \libgcrypt.lib(ecc.o) Error 22 error LNK2001: unresolved external symbol _gpg_err_code_from_syserror D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt.lib(random-fips.o) Error 23 error LNK2001: unresolved external symbol_gpgercodefrom__syserror D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt.lib(mpicoder.o) Error 24 error LNK2001: unresolved external symbol _gpg_err_code_from_syserror D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt.lib(cipher.o) Error 25 error LNK2001: unresolved external symbol _gpg_err_code_from_syserror D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\ vlcwin\libvlccore\libgcrypt.lib(pubkey.o) Error 26 error LNK2001: unresolved external symbol _gpg_err_code_from_syserror D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt.lib(kdf.o) Error 27 error LNK2019: unresolved external symbol _snprintf 在函数 __gcry_pk_get_keygrip D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt.lib(pubkey.o) 错误 28 错误 LNK2001: 无法解析的外部符号 _snprintf D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt.lib(md.o) 错误 29 错误 LNK2001: 无法解析的外部符号 _snprintf D:\VidPlaya_offline\TryingToIncludeUpdateFacility\TryingToIncludeUpdateFacility\TryingToIncludeUpdateFacility\ vlcwin\libvlccore\libgcrypt.lib(ecc.o) Error 30 error LNK2001: unresolved external symbol _snprintf D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt.lib(rndw32.o) Error 31 error LNK2019: unresolved external symbol在函数 _init_pool D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt.lib(libgcrypt_la-secmem.o) 中引用的 _getpagesize 错误 32 错误 LNK2019:在函数 _x931_get_dt D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt.lib(random-fips.o) 中引用的未解析的外部符号 _gettimeofday (random-fips.o) 错误 33 错误 LNK2001:未解析的外部符号 _gettimeofday D:\VidPlaya_offline\Vvlcplay_PluginUpdateFbeddedEmbeddedity\Vvlcplayid \libvlccore\libgcrypt.lib(random-csprng.o) Error 34 error LNK1120: 10 unresolved externals D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\Release\libvlccore.dll Error 89 error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall UpdateDialog::metaObject(void)const " (?metaObject@UpdateDialog@@UBEPBUQMetaObject@@XZ) D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\lib_plugin\help.obj 错误 90 错误 LNK2001:无法解析的外部符号“public:virtual void * __thiscall UpdateDialog::qt_metacast(char const *)”(?qt_metacast@UpdateDialog@@UAEPAXPBD@Z) D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\lib_plugin\help.obj 错误 91 错误 LNK2001:无法解析的外部符号“public:virtual int __thiscall UpdateDialog::qt_metacall(enum QMetaObject::Call,int,void * *)”(? qt_metacall@UpdateDialog@@UAEHW4Call@QMetaObject@@HPAPAX@Z) D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\lib_plugin\help.obj Error 92 error LNK1120: 3 unresolved externals D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\Release\plugins\lib_plugin.dll
有关此的任何建议都会有所帮助。
ios - 交叉编译到静态库 (libgcrypt) 以在 iOS 上使用
我已经从https://www.gnupg.org/download/index.html下载了最新的 libgcrypt 和 libgpg-error 库。我已经使用 ./configure --enable-static --disable-shared 成功构建(命令行)两个库;制作 ; 在我的 Mac 上安装(Mavericks w/OSX 10.10 和最新的 Xcode 6.1)。
我可以从我正在构建的 OS X 客户端应用程序中很好地链接到这些新库。到目前为止,一切都很好。刚刚好。但是,我还需要使用相同的源代码构建一个 iOS 客户端。
问题:
1)我需要为(模拟器,Mac和iOS)构建通用静态库的库的命令行构建序列有哪些修改?2) 还是我需要为 iOS 构建单独的静态库?如果是这样,我需要什么命令行魔法来完成正确的目标架构?
c - 静态链接创建分段错误错误
我在静态链接我的 C 应用程序时遇到问题。所有库都存在(.a),就在一个月前,我能够静态链接我的应用程序而没有错误。但是,一旦我在 Eclipse 中激活静态链接选项,我就可以编译而不会出现错误,但是当我尝试运行它时,我会收到一个“分段错误”并且它会停止。
我尝试调试,这就是 eclipse 向我展示的内容:
我使用以下库:-lgcrypt -lgpg-error -lmxml -lpthread -lrt。任何想法可能是什么问题?我也可以发布 gdb 跟踪,但它很长。
链接器命令: 调用: 调用: GCC C 链接器 gcc -static -o "X - Client" ./src/lib/stopwatch-0.2/stopwatch.o ./src/lib/rscode-1.3/berlekamp.o ./src/ lib/rscode-1.3/crcgen.o ./src/lib/rscode-1.3/galois.o ./src/lib/rscode-1.3/rs.o ./src/lib/Salsa20/ecrypt.o ./src/ lib/helper-Client.o ./src/PoR-Client.o -lgcrypt -lgpg-error -lmxml -lpthread -lrt 完成构建目标:X - Client
c++ - 在 libgcrypt 中解密 Crypto++ 中加密数据的步骤
由于目标平台上的 C 语言限制,我需要在 libgcrypt 中使用 Crypto++ 解密加密数据。所以我决定使用 libgcrypt,因为它支持 AES128 和 GCM 模式。
在 Crypto++ 中,数据以这种方式加密:
并以这种方式成功解密:
但是当我尝试ciphertext
通过以下步骤使用 libgcrypt 解码时,解码的数据是错误的:
gcry_cipher_open()
gcry_cipher_setkey()
gcry_cipher_setiv()
- 分离密文和认证标签
gcry_cipher_decrypt(cipher text)
gcry_cipher_checktag(authentication tag)
我是否错过了复制 Crypto++ 解码过程的任何步骤?
Gcrypt解密代码(预期输出Decrypted cipher = password
):
编辑:为了清楚起见,我正在寻找的解密步骤是针对ciphertext
上面显示的 Crypto++ 加密函数的输出;encrypt_data()
. _ 所以我不会接受任何不能应用于成功解密的答案ciphertext
。
c - 从 gcry_cipher_decrypt 确定解密数据的大小?
我正在使用 AES/GCM,但以下是其他模式的一般问题,例如 AES/CBC。我有以下调用libgcrypt
:
我无法弄清楚如何确定生成的恢复文本的大小。我已经检查了使用密码句柄参考,并且没有讨论它(并且'pad有0次命中)。我还在和中检查了libgrcrypt
自测,但它们使用相同的超大缓冲区,并且从不将缓冲区修剪为实际大小。tests/basic.c
tests/fipsdrv.c
如何确定recovered
缓冲区中返回给我的数据的大小?
java - 使用 BouncyCastle (java) 和 Gcrypt (C) 加密给出不同的结果
我编写了这个简单的 Java 程序,它加密一个字符串并输出 iv、salt、派生密钥和密文的十六进制值。
在下面的 C 程序中,iv 和 salt 使用上述 Java 程序给出的值进行初始化。由于文本的长度为 32 字节,因此无需填充。
我的问题是这两个程序中的派生密钥不一样。为什么?
充气城堡派生功能与 gcry_kdf_derive 的工作方式不同吗?
谢谢!