<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title>Mitch Dempsey</title>
  <id>http://www.mitchdempsey.com/</id>
  <updated>2013-05-31T09:58:07-07:00</updated>

  <author>
    <name>Mitch Dempsey</name>
    <email>mitch@mitchdempsey.com</email>
  </author>

  
  <entry>
    <title>Apartment Doorbell Notifications</title>
    <link href="http://www.mitchdempsey.com/blog/2013/03/apartment-doorbell-notifications.html"/>
    <id>http://www.mitchdempsey.com/blog/2013/03/apartment-doorbell-notifications</id>
    <updated>2013-03-01T00:00:00-08:00</updated>
    <summary type="html">&lt;p&gt;My apartment complex currently has a phone-based doorbell system to let visitors enter the complex. Visitors find the resident&amp;#8217;s name on a callbox, and then call the resident. The resident verifies friend of foe, and can press &lt;code&gt;9&lt;/code&gt; to open the door.&lt;/p&gt;</summary>
    <content type="html">&lt;p&gt;My apartment complex currently has a phone-based doorbell system to let visitors enter the complex. Visitors find the resident&amp;#8217;s name on a callbox, and then call the resident. The resident verifies friend of foe, and can press &lt;code&gt;9&lt;/code&gt; to open the door.&lt;/p&gt;

&lt;p&gt;I didn&amp;#8217;t want my visitors to have to rely on me being able to answer the phone in order to enter. Especially if I have them &amp;#8220;follow me in&amp;#8221;, there is no reception in the parking garage, so they would be stuck in the garage for a few minutes. Or, if I did not hear my phone ring, I still want friends to be able to come directly to my apartment door. I also thought it would just be pretty cool and nerdy to have it automated.&lt;/p&gt;

&lt;p&gt;After doing some reading online about various setups, I decided to go with &lt;a href='http://www.asterisk.org/'&gt;Asterisk&lt;/a&gt; and combine it with a small Rails application that would send notifications using &lt;a href='http://growl.info/'&gt;Growl&lt;/a&gt; and &lt;a href='http://www.prowlapp.com/'&gt;Prowl&lt;/a&gt;. My goal was that whenever a guest dialed my extension on the gate, all my computers (including my media center) would show a notification on screen alerting me of their entry. As a bonus, it also would send a notification to my iPhone so that even if I wasn&amp;#8217;t at home, I would know if someone was over.&lt;/p&gt;

&lt;h2 id='setting_up_asterisk'&gt;Setting up Asterisk&lt;/h2&gt;

&lt;p&gt;The first step with Asterisk was routing a phone number to the asterisk server. Since I did not have a landline in my apartment, I decided to get a SIP endpoint that I could connect to asterisk. After looking around online, I decided to go with &lt;a href='http://www.sipgate.com/'&gt;sipgate&lt;/a&gt;. I was able to get a free number that would take inbound calls and could route them to asterisk. Perfect.&lt;/p&gt;

&lt;p&gt;To connect with sipgate, you need to tell asterisk how it should connect to your VoIP provider. You need to edit (or create) a &lt;code&gt;sip.conf&lt;/code&gt; folder that will let you configure any SIP settings. Below is the file from my server.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;; sip.conf
;
; SipGate Info
; SIPGATE_USER - your sipgate username
; SIPGATE_PASS - your sipgate secret/password

[general]
tcpenable=no
srvlookup=yes
register=&amp;gt; SIPGATE_USER:SIPGATE_PASS@sipgate/SIPGATE_USER

[sipgate]
type=peer
secret=SIPGATE_PASS
insecure=invite
username=SIPGATE_USER
defaultuser=SIPGATE_USER
fromuser=SIPGATE_USER
context=sipgate_in
fromdomain=sipgate.com
host=sipgate.com
outboundproxy=proxy.live.sipgate.com
qualify=yes
disallow=all
allow=ulaw
dtmfmode=rfc2833&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Next, I needed to setup a route for sipgate. I decided that I wanted to route all inbound calls from sipgate directly to the door program. You can add this configuration to the bottom of your &lt;code&gt;extensions.conf&lt;/code&gt; file. In &lt;code&gt;sip.conf&lt;/code&gt; I configured asterisk to use &lt;code&gt;[sipgate_in]&lt;/code&gt; as the &amp;#8220;context&amp;#8221; for any calls from sipgate. (You can see above the &lt;code&gt;context=&lt;/code&gt; setting).&lt;/p&gt;

&lt;p&gt;The block below configures the actions that should be taken should a call be in the &lt;code&gt;sipgate_in&lt;/code&gt; context. I decided that I wanted all calls to be routed directly to my extension called &lt;code&gt;door-access&lt;/code&gt;. After opening the door, asterisk should immediately hang up the call.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;[sipgate_in]
exten =&amp;gt; SIPGATE_USER,1,Goto(door-access,s,1)
exten =&amp;gt; SIPGATE_USER,n,Hangup&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Next, you need to configure the &lt;code&gt;door-access&lt;/code&gt; extension to perform the required actions to open the door. What I wanted the system to do was:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Answer the call&lt;/li&gt;

&lt;li&gt;Say &amp;#8220;Access Granted&amp;#8221;&lt;/li&gt;

&lt;li&gt;Send a growl notification&lt;/li&gt;

&lt;li&gt;&amp;#8220;Press&amp;#8221; 9 to open the door&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;So I added the following script to my &lt;code&gt;extensions.conf&lt;/code&gt; file:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;[door-access]
exten =&amp;gt; s,1,Answer(500)
exten =&amp;gt; s,n,Playback(silence/1)
exten =&amp;gt; s,n,Playback(access-granted)
exten =&amp;gt; s,n,System(curl -s -d &amp;quot;callerid=${CALLERID(num)}&amp;quot; http://doorbell.mitchdempsey.net/asterisk &amp;gt;/dev/null)
exten =&amp;gt; s,n,SendDTMF(99999)
exten =&amp;gt; s,n,Hangup&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;A few things I added were the &lt;code&gt;Playback(silence/1)&lt;/code&gt; line. This plays a second of silence, which allows the other system to enable the speakers or whatever. I found after testing that if I didn&amp;#8217;t have that line, then the &amp;#8220;Access Granted&amp;#8221; phrase would be cut off in the beginning.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;System()&lt;/code&gt; line is what submits a POST request to the rails application. It also passes the caller&amp;#8217;s phone number. I realized that each door at my apartment had a different telephone number, so I could easily tell exactly which door someone entered from just based on the phone number.&lt;/p&gt;

&lt;h2 id='rails_application'&gt;Rails Application&lt;/h2&gt;

&lt;p&gt;The Rails application side was relatively simple. I have a single page that accepts a POST request containing the &lt;code&gt;callerid&lt;/code&gt;. It does a simple lookup to find out which door the specified number corresponds to. Once it has determined the location of the door, it fires off a Growl notification to all computers in the apartment, and then submits a notification to Prowl, which is then sent to my iPhone.&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='ruby'&gt;&lt;span class='c1'&gt;# POST /asterisk&lt;/span&gt;
&lt;span class='k'&gt;def&lt;/span&gt; &lt;span class='nf'&gt;asterisk&lt;/span&gt;
  &lt;span class='c1'&gt;# the phone number of the door&lt;/span&gt;
  &lt;span class='n'&gt;callerid&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='n'&gt;params&lt;/span&gt;&lt;span class='o'&gt;[&lt;/span&gt;&lt;span class='ss'&gt;:callerid&lt;/span&gt;&lt;span class='o'&gt;]&lt;/span&gt;
    
  &lt;span class='c1'&gt;# Search the gate code&lt;/span&gt;
  &lt;span class='vi'&gt;@gate_phone&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='no'&gt;GatePhone&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='n'&gt;find_or_create_by_phone_number&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='n'&gt;callerid&lt;/span&gt;&lt;span class='p'&gt;)&lt;/span&gt;
  
  &lt;span class='c1'&gt;# Submit a request to Prowl&lt;/span&gt;
  &lt;span class='no'&gt;Prowler&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='n'&gt;notify&lt;/span&gt; &lt;span class='s2'&gt;&amp;quot;Gate Entry&amp;quot;&lt;/span&gt;&lt;span class='p'&gt;,&lt;/span&gt; &lt;span class='s2'&gt;&amp;quot;Visitor entered from &lt;/span&gt;&lt;span class='si'&gt;#{&lt;/span&gt;&lt;span class='vi'&gt;@gate_phone&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='n'&gt;location&lt;/span&gt;&lt;span class='si'&gt;}&lt;/span&gt;&lt;span class='s2'&gt;&amp;quot;&lt;/span&gt;
  
  &lt;span class='c1'&gt;# Notify all the computers over Growl&lt;/span&gt;
  &lt;span class='no'&gt;NotifyGrowlHost&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='n'&gt;where&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='ss'&gt;:gate_entry&lt;/span&gt; &lt;span class='o'&gt;=&amp;gt;&lt;/span&gt; &lt;span class='kp'&gt;true&lt;/span&gt;&lt;span class='p'&gt;)&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='n'&gt;each&lt;/span&gt; &lt;span class='k'&gt;do&lt;/span&gt; &lt;span class='o'&gt;|&lt;/span&gt;&lt;span class='n'&gt;growl_host&lt;/span&gt;&lt;span class='o'&gt;|&lt;/span&gt;
    &lt;span class='n'&gt;g&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='no'&gt;Growl&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='n'&gt;new&lt;/span&gt; &lt;span class='n'&gt;growl_host&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='n'&gt;host&lt;/span&gt;&lt;span class='p'&gt;,&lt;/span&gt; &lt;span class='s2'&gt;&amp;quot;mr-universe&amp;quot;&lt;/span&gt;&lt;span class='p'&gt;,&lt;/span&gt; &lt;span class='o'&gt;[&lt;/span&gt;&lt;span class='s2'&gt;&amp;quot;gate-entry&amp;quot;&lt;/span&gt;&lt;span class='o'&gt;]&lt;/span&gt;&lt;span class='p'&gt;,&lt;/span&gt; &lt;span class='kp'&gt;nil&lt;/span&gt;&lt;span class='p'&gt;,&lt;/span&gt; &lt;span class='n'&gt;growl_host&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='n'&gt;password&lt;/span&gt;
    &lt;span class='n'&gt;g&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='n'&gt;notify&lt;/span&gt; &lt;span class='s2'&gt;&amp;quot;gate-entry&amp;quot;&lt;/span&gt;&lt;span class='p'&gt;,&lt;/span&gt; &lt;span class='s2'&gt;&amp;quot;Gate Entry Notification&amp;quot;&lt;/span&gt;&lt;span class='p'&gt;,&lt;/span&gt; &lt;span class='s2'&gt;&amp;quot;Visitor entered via &lt;/span&gt;&lt;span class='si'&gt;#{&lt;/span&gt;&lt;span class='vi'&gt;@gate_phone&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='n'&gt;location&lt;/span&gt;&lt;span class='si'&gt;}&lt;/span&gt;&lt;span class='s2'&gt;&amp;quot;&lt;/span&gt;  
  &lt;span class='k'&gt;end&lt;/span&gt;
&lt;span class='k'&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;That&amp;#8217;s about it! Not very complicated, but pretty useful.&lt;/p&gt;</content>
  </entry>
  
  <entry>
    <title>Signing Java code with a real certificate</title>
    <link href="http://www.mitchdempsey.com/blog/2013/02/code-signing.html"/>
    <id>http://www.mitchdempsey.com/blog/2013/02/code-signing</id>
    <updated>2013-02-28T00:00:00-08:00</updated>
    <summary type="html">&lt;p&gt;This guide will walk you through signing your java code using a legitimate certificate (instead of a self-signed certificate).&lt;/p&gt;</summary>
    <content type="html">&lt;p&gt;This guide will walk you through signing your java code using a legitimate certificate (instead of a self-signed certificate).&lt;/p&gt;

&lt;h2 id='step_1_generate_a_key_pair'&gt;Step 1: Generate a key pair&lt;/h2&gt;

&lt;p&gt;You will need to generate a key as well as a certificate signing request (CSR). You &lt;em&gt;must&lt;/em&gt; keep your key private. The CSR will be sent to the certificate authority (such as &lt;a href='http://www.digicert/'&gt;DigiCert&lt;/a&gt; for them to sign.&lt;/p&gt;

&lt;p&gt;First, we need to generate a key/certificate pair and store it in a java key store. Make sure you specify actual values for &lt;code&gt;-storepass&lt;/code&gt; and &lt;code&gt;-keypass&lt;/code&gt;, which are the passwords for the keystore, and the keypair, respectively.&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='bash'&gt;&lt;span class='nv'&gt;$ &lt;/span&gt;keytool -genkey -alias acme -keyalg RSA -keysize 2048 &lt;span class='se'&gt;\&lt;/span&gt;
    -keystore mykeystore.jks &lt;span class='se'&gt;\&lt;/span&gt;
    -storepass &lt;span class='s2'&gt;&amp;quot;changeme123&amp;quot;&lt;/span&gt; &lt;span class='se'&gt;\&lt;/span&gt;
    -keypass &lt;span class='s2'&gt;&amp;quot;password123&amp;quot;&lt;/span&gt; &lt;span class='se'&gt;\&lt;/span&gt;
    -dname &lt;span class='s2'&gt;&amp;quot;CN=Acme Company, O=Acme Company, L=New York City, ST=New York, C=US&amp;quot;&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This will create the file &lt;code&gt;mykeystore.jks&lt;/code&gt; which will contain a single keypair under the alias of &lt;code&gt;acme&lt;/code&gt;. Right now, you have a self-signed certificate. When a user tries to start your program, they will be shown an error saying that the code was signed by an untrusted source. This is what we want to prevent.&lt;/p&gt;

&lt;h2 id='step_2_generate_a_certificate_signing_request'&gt;Step 2: Generate a certificate signing request&lt;/h2&gt;

&lt;p&gt;Next, you will need to generate the CSR that can be sent to the certificate authority. The following command will export a CSR corresponding with the keypair that was generated above. You will be prompted to enter the keystore password (&lt;code&gt;-storepass&lt;/code&gt;) as well as the key password for &amp;#8220;acme&amp;#8221; (&lt;code&gt;-keypass&lt;/code&gt;).&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='bash'&gt;&lt;span class='nv'&gt;$ &lt;/span&gt;keytool -certreq -alias acme -file acme_csr.csr -keystore mykeystore.jks
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;You now have a file called &lt;code&gt;acme_csr.csr&lt;/code&gt;. You will send this to the certificate authority of your choice and they will sign it. You may be offered the option of various formats for them to give you the signed certificate in. I find the easiest is a single &lt;code&gt;.p7b&lt;/code&gt; file with the entire certificate chain added.&lt;/p&gt;

&lt;h2 id='step_3_import_certificate_authority_reply'&gt;Step 3: Import certificate authority reply&lt;/h2&gt;

&lt;p&gt;Now that you have your &lt;code&gt;.p7b&lt;/code&gt; file (we will call it &lt;code&gt;acme_certs.p7b&lt;/code&gt;) from the certificate authority, you need to import it into your keystore. Currently in your keystore, you have a key and a certificate (that form a &amp;#8220;keypair&amp;#8221;). The key must remain, but we want to overwrite the self-signed certificate with the certificate from the certificate authority.&lt;/p&gt;

&lt;p&gt;To inspect the response, and make sure we have the certificate we need, you can run the following command:&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='bash'&gt;&lt;span class='nv'&gt;$ &lt;/span&gt;openssl pkcs7 -in acme_certs.p7b -print_certs
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Scroll to the top, and you should see &lt;code&gt;subject=CN=Acme Company/O=Acme Company/L=New York City/ST=New York/C=US&lt;/code&gt;. If you do not see this anywhere in the output, then you have the wrong certificate or something went horribly wrong.&lt;/p&gt;

&lt;p&gt;Once we verified we have the correct certificate, we need to import the reply. To import the response, run the following command:&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='bash'&gt;&lt;span class='nv'&gt;$ &lt;/span&gt;keytool -import -trustcacerts -alias acme -file acme_certs.p7b -keystore mykeystore.jks
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id='step_4_convert_java_keystore_to_pfx_optional'&gt;Step 4: Convert Java keystore to PFX (optional)&lt;/h2&gt;

&lt;p&gt;This step is only needed if you want to sign executables for Windows. Microsoft code-signing uses a &lt;code&gt;.pfx&lt;/code&gt; file which is a PKCS12 keystore. (A PKCS12 keystore is very similar to Java&amp;#8217;s keystore except that it only stores a single keypair).&lt;/p&gt;

&lt;p&gt;To convert from your JKS to PFX, do the following:&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='bash'&gt;&lt;span class='nv'&gt;$ &lt;/span&gt;keytool -importkeystore &lt;span class='se'&gt;\&lt;/span&gt;
    -srckeystore mykeystore.jks -srcstoretype JKS &lt;span class='se'&gt;\&lt;/span&gt;
    -destkeystore mykeystore.pfx -deststoretype PKCS12
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;You now have an acceptable certificate that can be used to sign JAR files and executables.&lt;/p&gt;</content>
  </entry>
  
  <entry>
    <title>Generating a DIRECT Domain Certificate</title>
    <link href="http://www.mitchdempsey.com/blog/2013/02/generating-direct-domain-certificates.html"/>
    <id>http://www.mitchdempsey.com/blog/2013/02/generating-direct-domain-certificates</id>
    <updated>2013-02-27T00:00:00-08:00</updated>
    <summary type="html">&lt;p&gt;This article will show you how to take an existing trust anchor key-pair and use it to generate domain certificates that can be used by the &lt;a href='http://directproject.org/'&gt;DIRECT Project&lt;/a&gt;. This assumes you have the &lt;code&gt;openssl&lt;/code&gt; command-line utility (available on Linux/Mac).&lt;/p&gt;</summary>
    <content type="html">&lt;p&gt;This article will show you how to take an existing trust anchor key-pair and use it to generate domain certificates that can be used by the &lt;a href='http://directproject.org/'&gt;DIRECT Project&lt;/a&gt;. This assumes you have the &lt;code&gt;openssl&lt;/code&gt; command-line utility (available on Linux/Mac).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prerequisites:&lt;/strong&gt; You must have the certificate and key associated with your trust anchor (&lt;code&gt;trustanchor.pem&lt;/code&gt;, &lt;code&gt;trustanchor.key&lt;/code&gt;) before performing these steps. If your trust anchor key has a passphrase, you will need to know that as well.&lt;/p&gt;

&lt;p&gt;Lets say our domain is &lt;code&gt;direct.mydomain.com&lt;/code&gt; and we need to generate a certificate for this domain.&lt;/p&gt;

&lt;p&gt;The first step is to generate a certificate signing request (CSR) for the domain.&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='bash'&gt;&lt;span class='nv'&gt;$ &lt;/span&gt;openssl req &lt;span class='se'&gt;\&lt;/span&gt;
    -newkey rsa:2048 &lt;span class='se'&gt;\&lt;/span&gt;
    -nodes &lt;span class='se'&gt;\&lt;/span&gt;
    -days 3650 &lt;span class='se'&gt;\&lt;/span&gt;
    -out direct.mydomain.com.csr &lt;span class='se'&gt;\&lt;/span&gt;
    -keyout direct.mydomain.com.key &lt;span class='se'&gt;\&lt;/span&gt;
    -subj &lt;span class='s1'&gt;&amp;#39;/C=US/ST=New York/L=New York City/O=Acme Corp/emailAddress=direct.mydomain.com/CN=direct.mydomain.com&amp;#39;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This will create two files. The first is the CSR, and the second is the private key for this domain.&lt;/p&gt;

&lt;p&gt;Next, we need to sign the certificate using our Trust Anchor.&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='bash'&gt;&lt;span class='nv'&gt;$ &lt;/span&gt;openssl x509 -req &lt;span class='se'&gt;\&lt;/span&gt;
    -in direct.mydomain.com.csr &lt;span class='se'&gt;\&lt;/span&gt;
    -CA trustanchor.pem &lt;span class='se'&gt;\&lt;/span&gt;
    -CAkey trustanchor.key &lt;span class='se'&gt;\&lt;/span&gt;
    -CAcreateserial &lt;span class='se'&gt;\&lt;/span&gt;
    -out direct.mydomain.com.pem &lt;span class='se'&gt;\&lt;/span&gt;
    -days 3650
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This will use the trust anchor&amp;#8217;s certificate and key to issue a domain certificate. The new certificate will be available in &lt;code&gt;direct.mydomain.com.pem&lt;/code&gt;. Note: If your CA has a passphrase, you will be prompted to enter it here.&lt;/p&gt;

&lt;p&gt;The DIRECT project requires all certificates be in DER format. To convert from PEM to DER format, do the following:&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='bash'&gt;&lt;span class='nv'&gt;$ &lt;/span&gt;openssl x509 -outform der -in direct.mydomain.com.pem -out direct.mydomain.com.der
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Finally, you need to create a PKCS12 key-pair. This will need to be uploaded to the DIRECT application so it can be served over DNS.&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='bash'&gt;&lt;span class='nv'&gt;$ &lt;/span&gt;openssl pkcs12 -export &lt;span class='se'&gt;\&lt;/span&gt;
    -in direct.mydomain.com.pem &lt;span class='se'&gt;\&lt;/span&gt;
    -inkey direct.mydomain.com.key &lt;span class='se'&gt;\&lt;/span&gt;
    -out direct.mydomain.com.p12 &lt;span class='se'&gt;\&lt;/span&gt;
    -name &lt;span class='s1'&gt;&amp;#39;direct_keypair&amp;#39;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Many DIRECT applications require that the &lt;code&gt;.p12&lt;/code&gt; file have an empty passphrase. When you are prompted to enter a passphrase, be sure to just push &lt;kbd&gt;Enter&lt;/kbd&gt;.&lt;/p&gt;

&lt;p&gt;You have now successfully generated a domain certificate for direct.mydomain.com!&lt;/p&gt;

&lt;p&gt;Just to be sure, you should inspect your new certificate to make sure it looks correct. To view the certificate, do the following:&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='bash'&gt;&lt;span class='nv'&gt;$ &lt;/span&gt;openssl x509 -in direct.mydomain.com.pem -text
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;You should see a response with something similar to:&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='bash'&gt;Certificate:
  Data:
    Version: 1 &lt;span class='o'&gt;(&lt;/span&gt;0x0&lt;span class='o'&gt;)&lt;/span&gt;
    Serial Number:
        f9:68:b1:ca:a9:b2:56:db
    Signature Algorithm: sha1WithRSAEncryption
    Issuer: &lt;span class='nv'&gt;CN&lt;/span&gt;&lt;span class='o'&gt;=&lt;/span&gt;Acme Corp Trust Authority
    Validity
        Not Before: Mar  1 21:05:07 2013 GMT
        Not After : Feb 27 21:05:07 2023 GMT
    Subject: &lt;span class='nv'&gt;C&lt;/span&gt;&lt;span class='o'&gt;=&lt;/span&gt;US, &lt;span class='nv'&gt;ST&lt;/span&gt;&lt;span class='o'&gt;=&lt;/span&gt;New York, &lt;span class='nv'&gt;L&lt;/span&gt;&lt;span class='o'&gt;=&lt;/span&gt;New York City, &lt;span class='nv'&gt;O&lt;/span&gt;&lt;span class='o'&gt;=&lt;/span&gt;Acme Corp/emailAddress&lt;span class='o'&gt;=&lt;/span&gt;direct.mydomain.com, &lt;span class='nv'&gt;CN&lt;/span&gt;&lt;span class='o'&gt;=&lt;/span&gt;direct.mydomain.com
    Subject Public Key Info:
    ...
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content>
  </entry>
  
</feed>