c - libsodium ed25519 密钥生成器打印
问题描述
我正在尝试使用 libsoudium 生成密钥并打印它们。这些密钥存储在哪里,我如何找到它们?这就是我在 C 中尝试做的事情。
unsigned char pk[crypto_sign_PUBLICKEYBYTES];
unsigned char sk[crypto_sign_SECRETKEYBYTES];
int crypto_sign_keypair(unsigned char *pk, unsigned char *sk);
printf("%s", pk);
这输出:H��H�。这意味着什么?
文档在这里是我试图调用的函数。 https://download.libsodium.org/doc/public-key_cryptography/public-key_signatures.html
解决方案
https://download.libsodium.org/doc/public-key_cryptography/public-key_signatures.html
例如:
unsigned char pk[crypto_sign_PUBLICKEYBYTES]; //Variable declarations
unsigned char sk[crypto_sign_SECRETKEYBYTES]; Variable declarations
crypto_sign_keypair(pk, sk);
NSData *privateKeyData = [NSData dataWithBytes:sk length:crypto_box_SECRETKEYBYTES];
NSData *publicKeyData = [NSData dataWithBytes:pk length:crypto_box_PUBLICKEYBYTES];
NSLog(@"%@",privateKeyData); // target publick key data and secret key data
NSLog(@"%@",publicKeyData);
//Other
NSLog(@"%s\n\n=====\n\n\n%s",pk,sk); //(nullable const void *)bytes
Byte *byte = (Byte *)[publicKeyData bytes];
NSLog(@"%s",byte);
推荐阅读
- python - 我想在产品有折扣价时显示折扣价
- python - 使用 QAbstractTableModel 在 pyqts QTableView 中插入和删除行
- python - 使用窗口和层次逻辑使用 Pandas 创建计算列
- azure - Azure ADDS 的域控制器策略
- algorithm - 如何找到具有 k 个负加权边的最短路径?
- c# - 记录 ASP.net 核心 Lambda 应用程序日志
- windows - Using git submodules as junctions in Windows
- apache-spark - Azure Data Lake Gen 2 存储中的 Parquet 与 Delta 格式
- python - 升级到最新的 moto 版本(1.3.15 和 1.3.16)后测试中断
- slurm - 作业未获得请求的内存