在构建时仅使用 shell 脚本生成一次私钥并保存到钥匙串中

Generate private key at build time using shell script only once & save into keychain

提问人:nirav 提问时间:11/17/2023 最后编辑:HangarRashnirav 更新时间:11/17/2023 访问量:53

问:

我使用 Apple 内置的安全框架生成私钥。

但根据客户的说法,他希望在构建时使用 shell 脚本生成, 在安装应用程序之前,仅保存到钥匙串中一次。

我的疑问是我们可以在 iOS 中使用脚本实现钥匙串吗? 我没有脚本编写经验,我在互联网上搜索后编写了以下脚本。

我尝试按照方式进行操作,但它显示错误非退出代码零。

#!/bin/bash

# Set the file name for the private key
private_key_file="private_key.pem"

# Generate a private key with RSA algorithm and save it to a file
openssl genpkey -algorithm RSA -out "$PROJECT_DIR/$private_key_file" -aes256

enter image description here

感谢您抽出宝贵时间接受采访。

iOS Bash 安全 加密

评论


答: 暂无答案