Skip to content
David Kittell
David Kittell

Application & System: Development / Integration / Orchestration

  • Services
    • Application Development
    • Online Application Integration
  • Code
  • Online Tools
  • Tech Support
David Kittell

Application & System: Development / Integration / Orchestration

MacOSX Terminal – Convert P7B Certificate to PEM/CER Certificate

Posted on August 8, 2016April 2, 2018 By David Kittell
#!/bin/sh

#  ConvertScript.sh
#
#  This script is designed to take a p7b certificate bundle and convert it to a cer certificate bundle
#
#  Created by David Kittell on 8/8/16.
#

clear

# Variables - Start
declare sCerCert=""
# Variables - Stop

echo "Current Directory: $(pwd)\n"

# Ask user for the directory that the p7b cert is in
printf "What directory is the p7b cert in?\n"
read sCertDirectory

# Evaluate the given directory
eval dir="$sCertDirectory"

sCertDirectory=$(echo $dir  | sed "s,/$,,")
echo "\nCert Location: $sCertDirectory\n"

# Loop through the given directory and convert each p7b file
echo "NOTE: Conversion does not remove the P7B file"
for filename in $sCertDirectory/*.p7b; do
    #echo "$filename\n"
    sCerCert=${filename%.p7b}.cer
    echo "Converting $filename to $sCerCert"
    openssl pkcs7 -inform DER -outform PEM -in $filename -print_certs > $sCerCert
done
Originally Posted on August 8, 2016
Last Updated on April 2, 2018
All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just what it appears it is doing. I accept no responsibility for any damage you may do with this code.

Related

Code Mac OS X Shell Mac OSX OpenSSL UNIX UNIX Shell Scripts OpenSSL

Post navigation

Previous post
Next post

Related Posts

Azure CLI – List All VMs with Details

Posted on December 24, 2017

az vm list –show-details –query ‘[].{VMName:name, OSType:storageProfile.osDisk.osType,VMSize:hardwareProfile.vmSize, Location: location,ResourceGroup:resourceGroup,PowerState:powerState, privateIPs: privateIps}’ -o table All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is…

Read More

SQL Statement Validator

Posted on June 28, 2013October 26, 2015

using System.IO; using Microsoft.Data.Schema.ScriptDom; using Microsoft.Data.Schema.ScriptDom.Sql; public List<string> SQLStmtValid(string sql) { TSql100Parser parser = new TSql100Parser(false); IScriptFragment fragment; IList<ParseError> errors; fragment = parser.Parse(new StringReader(sql), out errors); if (errors != null && errors.Count > 0) { List<string> errorList = new List<string>(); foreach (var error in errors) { errorList.Add(error.Message); } return errorList;…

Read More

Basic4Android – Compass Direction

Posted on September 15, 2017

Sub GetCompassDirection(bearing As Double) As String Dim tmp As Int ‘ Set Default Direction Dim direction As String : direction = "N" tmp = Floor(Round(bearing / 22.5)) Select Case tmp Case 1 direction = "NNE" Case 2 direction = "NE" Case 3 direction = "ENE" Case 4 direction = "E"…

Read More

Code

Top Posts & Pages

  • PowerShell - Rename Pictures to Image Taken
  • Front Page
  • C# - Start/Stop/Restart Services
  • MacPorts / HomeBrew - Rip CD tracks from terminal
  • PowerShell - Show File Extensions

Recent Posts

  • Javascript – Digital Clock with Style
  • BASH – Web Ping Log
  • BASH – Picture / Video File Name Manipulation
  • Mac OSX Terminal – Create SSH Key
  • Bash – Rename Picture

Top Posts

  • PowerShell - Rename Pictures to Image Taken
  • C# - Start/Stop/Restart Services
  • MacPorts / HomeBrew - Rip CD tracks from terminal
  • PowerShell - Show File Extensions
  • Open On Screen Keyboard (OSK)
  • SQLite - Auto-Increment / Auto Generate GUID
©2025 David Kittell | WordPress Theme by SuperbThemes