NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
converting .cer to .pem via php script


Joined: 26 May 2012
Posts: 2
Reply with quote
please provide me php scripts for these OpenSSl commands :

Convert the .cer file into a .pem file :
$ openssl x509 -in aps_developer_identity.cer -inform der -out PushChatCert.pem

Convert the private key’s .p12 file into a .pem file:
$ openssl pkcs12 -nocerts -out PushChatKey.pem -in PushChatKey.p12
Enter Import Password:
MAC verified OK
Enter PEM pass phrase:
Verifying - Enter PEM pass phrase:

these above mentioned commands are executed on terminal .... i want to perform conversion from .cer / .p12 to .pem via php script running at the server end !!!

Please help me asap !!!
Thanks
View user's profileFind all posts by nikhil38Send private message


Joined: 26 May 2012
Posts: 2
Reply with quote
I have cracked this issue myself ! Hereby i'm posting the solution so that any one still looking for the same issue can work out with this issue .



<?php

//convert .cer file to .pem
system('openssl x509 -in path/to/certificate_file.cer -inform DER -out path/to/certificate_file.pem -outform PEM ');

// convert .p12 file to .pem [Note : if u used passphrase while encryting ur key , u need to mention it over here ]
system('openssl pkcs12 -nocerts -out path/to/TestingKey.pem -in path/to/TestingKey.p12 -passout pass:yournewpassphrase -passin pass:initialpassphrase');
system('openssl rsa -in TestingKey.pem -out TestingKey-noenc.pem -passin pass:yournewpassphrase');

?>
View user's profileFind all posts by nikhil38Send private message
converting .cer to .pem via php script
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic