我想使用 openSSL 生成一些证书并通过 REST 提供它们。
我找不到在linux中调用openssl来生成证书并在ballerina中使用它的方法。
未找到插件
或者还有另一种方法可以在芭蕾舞演员中生成证书。 ballerina/crypto 模块中对 KeyStore 有一些支持 https://ballerina.io/learn/api-docs/ballerina/crypto.html#KeyStore
这将通过 ballerina/system 模块随 ballerina-1.0.0 发行版提供。 API 将如下所示。
# Executes an operating system command as a subprocess of the current process.
#
# + command - The name of the command to be executed
# + env - Environment variables to be set to the process
# + dir - The current working directory to be set to the process
# + args - Command arguments to be passed in
# + return - Returns a `Process` object in success, or an `Error` if a failure occurs
public function exec(@untainted string command, @untainted map<string> env = {},
@untainted string? dir = (), @untainted string... args)
returns Process|Error = external;
从 Ballerina Swanelake 版本开始,您可以使用
exec
模块提供的 ballerina/os
功能在 Ballerina 中执行操作系统命令或脚本。此功能允许您从 Ballerina 代码中运行外部命令和脚本。
这是一个简短的例子:
import ballerina/io;
import ballerina/os;
public function main() returns error? {
os:Process exec = check os:exec({
value: "ls",
arguments: ["-l"]
});
int status = check exec.waitForExit();
io:println(string `Process exit with status: ${status}`);
byte[] output = check exec.output(io:stdout);
io:println(check string:fromBytes(output));
}
有关更多详细信息,您可以参考os
模块的
官方文档。