当前位置: 首页 > ops >正文

Mac 使用 softhsm

Mac 使用 softhsm

卸载

由于 brew 安装 softhsm 使用的是 boringssl,java 使用通过 JSP 调用 softhsm 会报如下的错误。

Assertion failed: (ret == 0), function digest_final, file boringssl_crypto_digests.m, line 41.

我们需要卸载已安装的 softhsm(如果是通过 brew 安装的话)。

brew unistall softhsm

注意: 我们 jar 程序会引用 /opt/homebrew/lib/softhsm/libsofthsm2.so,卸载后此路径会失效,所以需要重新链接。

安装必要依赖

brew install automake libtool pkg-config cppunit openssl

编译 softhsm

请在本地合理安排位置,将 https://github.com/softhsm/SoftHSMv2 进行 clone,分支默认 develop 即可。

git clone git@github.com:softhsm/SoftHSMv2.git
cd SoftHSMv2
./autogen.sh
./configure --with-openssl=$(brew --prefix openssl)
make
sudo make install

注意:自行编译后,所需依赖位置: /usr/local/lib/softhsm/libsofthsm2.so

(可选)链接

注意: 我们 jar 程序会引用 /opt/homebrew/lib/softhsm/libsofthsm2.so,卸载后此路径会失效,所以需要重新链接。

ln -s [源文件或目录] [目标文件或目录]

mkdir -p /opt/homebrew/lib/softhsm/
ln -s /usr/local/lib/softhsm /opt/homebrew/lib

生成 slot

softhsm2-util --init-token --slot 0 --label test --pin 123456 --so-pin 123456

在 java 上使用 JSP 以 PKCS11 协议加载 softhsm。

--
name = SoftHSM
library = /opt/homebrew/lib/softhsm/libsofthsm2.so
slot = {SLOT}
attributes(generate, *, *) = {CKA_TOKEN = true
}
attributes(generate, CKO_CERTIFICATE, *) = {CKA_PRIVATE = false
}
attributes(generate, CKO_PUBLIC_KEY, *) = {CKA_PRIVATE = false
}
destroyTokenAfterLogout = false
cleaner.shortInterval = 2000
cleaner.longInterval = 60000

ref

  • https://gist.github.com/mkontani/5b683ffe9508bda0c6c96ee50938225f
  • Install SoftHSM and Access it via Java Program
  • https://github.com/parallaxsecond/rust-cryptoki/issues/191
    Assertion failed: (ret == 0), function digest_final, file boringssl_crypto_digests.m, line 41.
http://www.xdnf.cn/news/19908.html

相关文章:

  • 革新光纤锁模技术:《Light: Science Applications》报道纳米腔增强型可饱和吸收器
  • 质量管理里常见的缩写QA、QC、QE都是什么意思?
  • 彻底搞懂面向对象分析(OOA)
  • Linux内存管理章节一:深入浅出Linux内存管理:从物理内存到ARM32的用户与内核空间
  • 逻辑回归基础
  • .NET GcPDF V8.2 新版本:人工智能 PDF 处理
  • Spring Boot 根据配置优雅的决定实现类
  • Meshroom 2025.1.0安装及使用参数模板介绍:二维图片转三维重建
  • 因为对象装箱拆箱导致的空指针异常
  • C#强制类型转换(显示转换)和安全类型转换
  • 野火STM32Modbus主机读取寄存器/线圈失败(三)-尝试将存贮事件的地方改成数组(非必要解决方案)(附源码)
  • VBA中类的解读及应用第二十七讲:利用类完成查找的方案-5
  • SVT-AV1 svt_aom_motion_estimation_kernel 函数分析
  • 详细学习计划
  • 百度前端社招面经
  • 云手机运行是否消耗自身流量?
  • Docker(④Shell脚本)
  • 【RNN-LSTM-GRU】第五篇 序列模型实战指南:从选型到优化与前沿探索
  • 应对反爬:使用Selenium模拟浏览器抓取12306动态旅游产品
  • 40,.Ansible角色(roles)
  • 具身智能多模态感知与场景理解:视觉探索
  • 如何本地编译servicecomb-java-chassis
  • Focal Loss
  • Elasticsearch 8 中 Nested 数据类型的使用方法
  • 【文献解读】ceRNA机制研究经典思路
  • Spring Boot项目中MySQL索引失效的常见场景与解决方案
  • 从群体偏好到解构对齐:大模型强化学习从GRPO到DAPO的“认知”进化
  • 【高并发内存池】四、中心缓存的设计
  • 疯狂星期四文案网第60天运营日记
  • GEO排名优化效益分析:为何AI搜索优化服务是当下性价比最高的流量投资?