fix(core): update
This commit is contained in:
26
scripts/create.p12.sh
Normal file
26
scripts/create.p12.sh
Normal file
@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Directory where the script and certificates will be stored
|
||||
SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
||||
CERT_DIR="$SCRIPT_DIR/../.nogit"
|
||||
|
||||
# Check if .nogit directory exists, if not, create it
|
||||
if [ ! -d "$CERT_DIR" ]; then
|
||||
mkdir -p "$CERT_DIR"
|
||||
fi
|
||||
|
||||
# Names of the files
|
||||
PRIVATE_KEY="$CERT_DIR/private.key"
|
||||
CERTIFICATE="$CERT_DIR/certificate.crt"
|
||||
P12_CERTIFICATE="$CERT_DIR/certificate.p12"
|
||||
|
||||
# Generate a private key
|
||||
openssl genpkey -algorithm RSA -out "$PRIVATE_KEY" -pkeyopt rsa_keygen_bits:2048
|
||||
|
||||
# Create a self-signed certificate
|
||||
openssl req -new -x509 -days 365 -key "$PRIVATE_KEY" -out "$CERTIFICATE"
|
||||
|
||||
# Convert to P12 format
|
||||
openssl pkcs12 -export -out "$P12_CERTIFICATE" -inkey "$PRIVATE_KEY" -in "$CERTIFICATE"
|
||||
|
||||
echo "P12 certificate generated at $P12_CERTIFICATE"
|
Reference in New Issue
Block a user