https://github.com/firsttimeez/simple-open-ssl
Execute OpenSSL commands directly from JavaScript. Provides a simple, cross-platform interface for cryptographic operations, certificate management, and security tasks.
https://github.com/firsttimeez/simple-open-ssl
command es6 execute generate interop javascript linux module open open-ssl openssl pki runner sign simple ssl tls verify windows x509
Last synced: about 2 months ago
JSON representation
Execute OpenSSL commands directly from JavaScript. Provides a simple, cross-platform interface for cryptographic operations, certificate management, and security tasks.
- Host: GitHub
- URL: https://github.com/firsttimeez/simple-open-ssl
- Owner: FirstTimeEZ
- License: apache-2.0
- Created: 2024-12-17T03:49:14.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-17T12:45:00.000Z (over 1 year ago)
- Last Synced: 2025-10-29T17:46:26.872Z (5 months ago)
- Topics: command, es6, execute, generate, interop, javascript, linux, module, open, open-ssl, openssl, pki, runner, sign, simple, ssl, tls, verify, windows, x509
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/simple-open-ssl
- Size: 2.69 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://www.npmjs.com/package/simple-open-ssl)
# Simple OpenSSL for Javascript
Execute `OpenSSL` commands directly from `JavaScript`.
Provides a simple, cross-platform interface for cryptographic operations, certificate management, and security tasks.
#### Usage:
```javascript
import { runCommandSync } from 'simple-open-ssl';
const standardOutput = runCommandSync(`x509 -in certificate.pem -enddate -noout`);
```
#### Windows:
Uses the included packaged version
```
OpenSSL 3.2.3 3 Sep 2024 (Library: OpenSSL 3.2.3 3 Sep 2024)
```
#### Linux/Other:
Uses the local version of `OpenSSl` that is already installed
```
manual install required if its not
Debian: sudo apt install openssl
RHEL: sudo yum install openssl
MacOS: brew install openssl
```
---------------------
# Exports
### `runCommandSync`
Executes an OpenSSL command synchronously.
Show jsdoc
```javascript
/**
* Executes an OpenSSL command synchronously.
*
* @description
* This function runs OpenSSL commands with platform-specific handling:
* - On Windows, it uses the packaged version of OpenSSL
* - On other platforms (e.g., Linux, macOS), it uses the locally installed OpenSSL
*
* @param {string} opensslCommand - The OpenSSL command to be executed, including any arguments.
* @param {Object} [execOptions] - Optional execution options for the synchronous command, Defaults to UTF-8 encoding if not provided.
* @param {string} [execOptions.encoding='utf-8'] - The encoding to use for command output.
* @param {string} [execOptions.cwd] - Current working directory for the command execution.
* @param {Object} [execOptions.env] - Environment variables for the command.
*
* @returns {string|undefined} The standard output from the executed command, or `undefined` if the command execution fails.
*/
export function runCommandSync(opensslCommand, execOptions = { encoding: 'utf-8' }) { /* */ }
```