Skip to content

Instantly share code, notes, and snippets.

@Ruzzz
Created August 24, 2015 17:30
Show Gist options
  • Save Ruzzz/3439ed89d61c8c29818e to your computer and use it in GitHub Desktop.
Save Ruzzz/3439ed89d61c8c29818e to your computer and use it in GitHub Desktop.
Convert x509 certificate from DER or PEM format to another format.
:: Contact: ruzzzua@gmail.com
:: Version: 2015.08.14
:: Dependencies: OpenSSL
@echo off
if "%1"=="" goto :USAGE
if "%2"=="" goto :USAGE
if "%1"=="-toder" goto :TODER
:TOPEM
:: Convert from DER to PEM (Default)
openssl x509 -inform der -in %1 -out %2
goto :eof
:TODER
:: Convert from PEM to DER (Default)
if "%3"=="" goto :USAGE
openssl x509 -outform der -in %2 -out %3
goto :eof
:USAGE
echo Convert x509 certificate from DER or PEM format to another format.
echo Usage: %~nx0 [-toder] from-file to-file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment