EzDevInfo.com

openssl interview questions

Top openssl frequently asked interview questions

Use RSA private key to generate public key?

Hi I don't really understand this one:

according to: http://www.madboa.com/geek/openssl/#key-rsa , You can generate a public key from a private key.

openssl genrsa -out mykey.pem 1024
openssl rsa -in mykey.pem -pubout > mykey.pub

My initial thinking was that they are generated in a pair together. Does RSA private key contain the sum? or the public key?


Source: (StackOverflow)

Rails 3 - no such file to load -- openssl

when running a Rails server, I get the following error: no such file to load -- openssl

I try a solution I find online. I go to ~/.rvm/src/ruby-1.9.2-head/ext/openssl. I type : ruby extconf.rb, but I get the following:

=== OpenSSL for Ruby configurator ===
=== Checking for system dependent stuff... ===
checking for t_open() in -lnsl... no
checking for socket() in -lsocket... no
checking for assert.h... yes
=== Checking for required stuff... ===
checking for openssl/ssl.h... no
=== Checking for required stuff failed. ===
Makefile wasn't created. Fix the errors above.

I cannot use make nor make install.


Source: (StackOverflow)

Advertisements

How to get an OpenSSL .pem file from .key and .crt files?

How can I create a PEM file from an SSL certificate? These are the files I have available: .crt, server.csr and server.key.


Source: (StackOverflow)

Ruby Bundle Symbol not found: _SSLv2_client_method (LoadError)

I was doing attempting to do some updates to openssl using homebrew and I somehow managed to break everything. I can't do anything now, this is what I get when I try to do bundle install:

$ bundle install
/Users/asServer/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in    `require': dlopen(/Users/asServer/.rbenv/versions/2.1.2/lib/ruby/2.1.0/x86_64-darwin13.0/openssl.bundle, 9): Symbol not found: _SSLv2_client_method (LoadError)
Referenced from: /Users/asServer/.rbenv/versions/2.1.2/lib/ruby/2.1.0/x86_64-darwin13.0/openssl.bundle
Expected in: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
in /Users/asServer/.rbenv/versions/2.1.2/lib/ruby/2.1.0/x86_64-darwin13.0/openssl.bundle - /Users/asServer/.rbenv/versions/2.1.2/lib/ruby/2.1.0/x86_64-darwin13.0/openssl.bundle
    from /Users/asServer/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Users/asServer/.rbenv/versions/2.1.2/lib/ruby/2.1.0/openssl.rb:17:in `<top (required)>'
    from /Users/asServer/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Users/asServer/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Users/asServer/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/security.rb:11:in `<top (required)>'
    from /Users/asServer/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Users/asServer/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Users/asServer/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/package.rb:43:in `<top (required)>'
    from /Users/asServer/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Users/asServer/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Users/asServer/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/dependency_installer.rb:3:in `<top (required)>'
    from /Users/asServer/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Users/asServer/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Users/asServer/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.3/lib/bundler/installer.rb:2:in `<top (required)>'
    from /Users/asServer/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.3/lib/bundler/cli/install.rb:78:in `run'
    from /Users/asServer/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.3/lib/bundler/cli.rb:146:in `install'
    from /Users/asServer/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.3/lib/bundler/vendor/thor/command.rb:27:in `run'
    from /Users/asServer/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.3/lib/bundler/vendor/thor/invocation.rb:121:in `invoke_command'
    from /Users/asServer/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.3/lib/bundler/vendor/thor.rb:363:in `dispatch'
    from /Users/asServer/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.3/lib/bundler/vendor/thor/base.rb:440:in `start'
    from /Users/asServer/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.3/lib/bundler/cli.rb:9:in `start'
    from /Users/asServer/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.3/bin/bundle:20:in `block in <top (required)>'
    from /Users/asServer/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.3/lib/bundler/friendly_errors.rb:5:in `with_friendly_errors'
    from /Users/asServer/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.3/bin/bundle:20:in `<top (required)>'
    from /Users/asServer/.rbenv/versions/2.1.2/bin/bundle:23:in `load'
    from /Users/asServer/.rbenv/versions/2.1.2/bin/bundle:23:in `<main>'

Source: (StackOverflow)

Using openssl what does "unable to write 'random state'" mean? [closed]

I'm generating a self-signed SSL certificate to protect my server's admin section, and I keep getting this message from OpenSSL:

unable to write 'random state'

What does this mean? A quick Google search yields nothing useful, so I thought I'd try out the new Stack Overflow!

This is on an Ubuntu server. I have upgraded libssl to fix the recent security vulnerability.


Source: (StackOverflow)

How to create a self-signed certificate with openssl?

I'm adding https support to an embedded linux device. I have tried to generate a self-signed certificate with these steps:

openssl req -new > cert.csr
openssl rsa -in privkey.pem -out key.pem
openssl x509 -in cert.csr -out cert.pem -req -signkey key.pem -days 1001
cat key.pem>>cert.pem

This works, but I get some errors with, for example, google chrome:

This is probably not the site you are looking for!
The site's security certificate is not trusted!

Am I missing something? Is this the correct way to build a self-signed certificate?


Source: (StackOverflow)

PEM_read_bio_PrivateKey() returns NULL in ECB mode only

PEM_read_bio_PrivateKey() returns NULL if a private key is encrypted by DES EDE in ECB mode. The issue happens in EVP_DecryptFinal_ex():

4128:error:06065064:digital envelope routines:EVP_DecryptFinal_ex:bad decrypt:evp_enc.c:330:

If the same private key is encrypted by DES EDE in CBC mode, this function works OK.

I checked, this issue is reproducible on openssl 0.9.8r/y versions (without FIPS). If openssl is built with FIPS the issue doesn't happen.

What causes this behaviour?

Thanks!


Source: (StackOverflow)

Windows Server 2012 R2 and IIS affected by Heartbleed exploit? [closed]

"OpenSSL 1.01 — the one production version affected — had been shipping since March 12, 2012"

Does this (above) mean that a Windows 2012 R2 server we ordered a month ago, now running HTTPS sites in IIS, is vulnerable to Heartbleed attacks?


I've read a post that suggests checking if your server is vulnerable, by using this site http://filippo.io/Heartbleed/ , but it's probably taking a ton of hits right now, as it's not responding.


Source: (StackOverflow)

Why is there a handshake failure when trying to run TLS over TLS with this code?

I tried to implement a protocol that can run TLS over TLS using twisted.protocols.tls, an interface to OpenSSL using a memory BIO.

I implemented this as a protocol wrapper that mostly looks like a regular TCP transport, but which has startTLS and stopTLS methods for adding and removing a layer of TLS respectively. This works fine for the first layer of TLS. It also works fine if I run it over a "native" Twisted TLS transport. However, if I try to add a second TLS layer using the startTLS method provided by this wrapper, there's immediately a handshake error and the connection ends up in some unknown unusable state.

The wrapper and the two helpers that let it work looks like this:

from twisted.python.components import proxyForInterface
from twisted.internet.error import ConnectionDone
from twisted.internet.interfaces import ITCPTransport, IProtocol
from twisted.protocols.tls import TLSMemoryBIOFactory, TLSMemoryBIOProtocol
from twisted.protocols.policies import ProtocolWrapper, WrappingFactory

class TransportWithoutDisconnection(proxyForInterface(ITCPTransport)):
    """
    A proxy for a normal transport that disables actually closing the connection.
    This is necessary so that when TLSMemoryBIOProtocol notices the SSL EOF it
    doesn't actually close the underlying connection.

    All methods except loseConnection are proxied directly to the real transport.
    """
    def loseConnection(self):
        pass


class ProtocolWithoutConnectionLost(proxyForInterface(IProtocol)):
    """
    A proxy for a normal protocol which captures clean connection shutdown
    notification and sends it to the TLS stacking code instead of the protocol.
    When TLS is shutdown cleanly, this notification will arrive.  Instead of telling
    the protocol that the entire connection is gone, the notification is used to
    unstack the TLS code in OnionProtocol and hidden from the wrapped protocol.  Any
    other kind of connection shutdown (SSL handshake error, network hiccups, etc) are
    treated as real problems and propagated to the wrapped protocol.
    """
    def connectionLost(self, reason):
        if reason.check(ConnectionDone):
            self.onion._stopped()
        else:
            super(ProtocolWithoutConnectionLost, self).connectionLost(reason)


class OnionProtocol(ProtocolWrapper):
    """
    OnionProtocol is both a transport and a protocol.  As a protocol, it can run over
    any other ITransport.  As a transport, it implements stackable TLS.  That is,
    whatever application traffic is generated by the protocol running on top of
    OnionProtocol can be encapsulated in a TLS conversation.  Or, that TLS conversation
    can be encapsulated in another TLS conversation.  Or **that** TLS conversation can
    be encapsulated in yet *another* TLS conversation.

    Each layer of TLS can use different connection parameters, such as keys, ciphers,
    certificate requirements, etc.  At the remote end of this connection, each has to
    be decrypted separately, starting at the outermost and working in.  OnionProtocol
    can do this itself, of course, just as it can encrypt each layer starting with the
    innermost.
    """
    def makeConnection(self, transport):
        self._tlsStack = []
        ProtocolWrapper.makeConnection(self, transport)


    def startTLS(self, contextFactory, client, bytes=None):
        """
        Add a layer of TLS, with SSL parameters defined by the given contextFactory.

        If *client* is True, this side of the connection will be an SSL client.
        Otherwise it will be an SSL server.

        If extra bytes which may be (or almost certainly are) part of the SSL handshake
        were received by the protocol running on top of OnionProtocol, they must be
        passed here as the **bytes** parameter.
        """
        # First, create a wrapper around the application-level protocol
        # (wrappedProtocol) which can catch connectionLost and tell this OnionProtocol 
        # about it.  This is necessary to pop from _tlsStack when the outermost TLS
        # layer stops.
        connLost = ProtocolWithoutConnectionLost(self.wrappedProtocol)
        connLost.onion = self
        # Construct a new TLS layer, delivering events and application data to the
        # wrapper just created.
        tlsProtocol = TLSMemoryBIOProtocol(None, connLost, False)
        tlsProtocol.factory = TLSMemoryBIOFactory(contextFactory, client, None)

        # Push the previous transport and protocol onto the stack so they can be
        # retrieved when this new TLS layer stops.
        self._tlsStack.append((self.transport, self.wrappedProtocol))

        # Create a transport for the new TLS layer to talk to.  This is a passthrough
        # to the OnionProtocol's current transport, except for capturing loseConnection
        # to avoid really closing the underlying connection.
        transport = TransportWithoutDisconnection(self.transport)

        # Make the new TLS layer the current protocol and transport.
        self.wrappedProtocol = self.transport = tlsProtocol

        # And connect the new TLS layer to the previous outermost transport.
        self.transport.makeConnection(transport)

        # If the application accidentally got some bytes from the TLS handshake, deliver
        # them to the new TLS layer.
        if bytes is not None:
            self.wrappedProtocol.dataReceived(bytes)


    def stopTLS(self):
        """
        Remove a layer of TLS.
        """
        # Just tell the current TLS layer to shut down.  When it has done so, we'll get
        # notification in *_stopped*.
        self.transport.loseConnection()


    def _stopped(self):
        # A TLS layer has completely shut down.  Throw it away and move back to the
        # TLS layer it was wrapping (or possibly back to the original non-TLS
        # transport).
        self.transport, self.wrappedProtocol = self._tlsStack.pop()

I have simple client and server programs for exercising this, available from launchpad (bzr branch lp:~exarkun/+junk/onion). When I use it to call the startTLS method above twice, with no intervening call to stopTLS, this OpenSSL error comes up:

OpenSSL.SSL.Error: [('SSL routines', 'SSL23_GET_SERVER_HELLO', 'unknown protocol')]

Why do things go wrong?


Source: (StackOverflow)

Need help converting p12 certificate into PEM using OpenSSL

I have openssl x64 on windows 7 which I downloaded from here https://code.google.com/p/openssl-for-windows/downloads/detail?name=openssl-0.9.8k_X64.zip

I'm attempting to run

openssl pkcs12 -export -in "path.p12" -out "newfile.pem" 

but I get an error.

unable to load private key

Source: (StackOverflow)

Can't open config file: /usr/local/ssl/openssl.cnf on Windows

I have installed OpenSSL 64. I want to use a certificate for my nodejs https server. I ran the following command:

openssl genrsa -out subdomain.domain.com.key 1024

But I have got the error:

WARNING: can't open config file: /usr/local/ssl/openssl.cnf
Loading 'screen' into random state - done
Generating RSA private key, 1024 bit long modulus
.........++++++
.........................................++++++
unable to write 'random state'
e is 65537 (0x10001)

How can I resolve it?
Is this the right command?


Source: (StackOverflow)

gem install fails with openssl failure

I tried to install cocoapods (http://cocoapods.org/) on my OSX Mountain Lion.

 moshe-mbp:~ moshem$ gem install cocoapods
 ERROR:  Could not find a valid gem 'cocoapods' (>= 0), here is why:
      Unable to download data from https://rubygems.org/ - SSL_connect returned=1 errno=0      state=SSLv3 read server key exchange B: bad ecpoint (https://rubygems.org/latest_specs.4.8.gz)

first I tried

 rvm reinstall all --force

then I tried

 brew upgrade openssl

    ==> Upgrading openssl
    ==> Downloading http://openssl.org/source/openssl-1.0.1e.tar.gz
    Already downloaded: /Library/Caches/Homebrew/openssl-1.0.1e.tar.gz
    ==> perl ./Configure --prefix=/usr/local/Cellar/openssl/1.0.1e --openssldir=/usr/local/etc/openssl zlib-dynamic shared d
    ==> make
    ==> make test
    ==> make install MANDIR=/usr/local/Cellar/openssl/1.0.1e/share/man MANSUFFIX=ssl
    ==> Caveats
    To install updated CA certs from Mozilla.org:

        brew install curl-ca-bundle

    This formula is keg-only: so it was not symlinked into /usr/local.

    Mac OS X already provides this software and installing another version in
    parallel can cause all kinds of trouble.

    The OpenSSL provided by OS X is too old for some software.

    Generally there are no consequences of this for you. If you build your
    own software and it requires this formula, you'll need to add to your
    build variables:

        LDFLAGS:  -L/usr/local/opt/openssl/lib
        CPPFLAGS: -I/usr/local/opt/openssl/include

    ==> Summary
    🍺  /usr/local/Cellar/openssl/1.0.1e: 429 files, 15M, built in 5.1 minutes

I then tried

openssl version

and still(!) gets the older version

moshe-mbp:~ moshem$ openssl version
OpenSSL 0.9.8r 8 Feb 2011
moshe-mbp:~ moshem$ 

what am I doing wrong? how can I install the cocoapods gem?

thanks


EDIT, trying @sean suggestion:

moshe-mbp:~ moshem$ brew update
Updated Homebrew from 672af665 to 10b4d426.
==> Updated Formulae
bash        wireshark
moshe-mbp:~ moshem$ brew install openssl
Error: openssl-1.0.1e already installed
moshe-mbp:~ moshem$ brew link openssl --force
Linking /usr/local/Cellar/openssl/1.0.1e... 1139 symlinks created
moshe-mbp:~ moshem$ brew install curl-ca-bundle
Error: curl-ca-bundle-1.87 already installed
moshe-mbp:~ moshem$ 
moshe-mbp:~ moshem$ openssl version
OpenSSL 0.9.8r 8 Feb 2011
moshe-mbp:~ moshem$ gem install cocoapods
ERROR:  Could not find a valid gem 'cocoapods' (>= 0), here is why:
          Unable to download data from https://rubygems.org/ - SSL_connect returned=1 errno=0 state=SSLv3 read server key exchange B: bad ecpoint (https://rubygems.org/latest_specs.4.8.gz)

EDIT (2) after fixing issues with brew doctor

moshe-mbp:~ moshem$ gem install cocoapods
ERROR:  Could not find a valid gem 'cocoapods' (>= 0), here is why:
          Unable to download data from https://rubygems.org/ - SSL_connect returned=1 errno=0 state=SSLv3 read server key exchange B: bad ecpoint (https://rubygems.org/latest_specs.4.8.gz)
moshe-mbp:~ moshem$ openssl version
OpenSSL 0.9.8r 8 Feb 2011
moshe-mbp:~ moshem$ brew update
Updated Homebrew from 10b4d426 to 6a00bc3c.
==> Updated Formulae
clozure-cl  python  python3
moshe-mbp:~ moshem$ brew install openssl
Error: openssl-1.0.1e already installed
moshe-mbp:~ moshem$ 
moshe-mbp:~ moshem$ echo $PATH
/Users/moshem/.rvm/gems/ruby-2.0.0-p0/bin:/Users/moshem/.rvm/gems/ruby-2.0.0-p0@global/bin:/Users/moshem/.rvm/rubies/ruby-2.0.0-p0/bin:/Users/moshem/.rvm/bin:/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/git/bin:/tools:/platforms:/platform-tools:
moshe-mbp:~ moshem$ 

EDIT after altering the /etc/paths

I edited the /etc/path files to:

/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin

closed terminal completly and reopend and it still launches the old version of openssl!

why?

moshe-mbp:~ moshem$ env $PATH
env: /Users/moshem/.rvm/gems/ruby-2.0.0-p0/bin:/Users/moshem/.rvm/gems/ruby-2.0.0-p0@global/bin:/Users/moshem/.rvm/rubies/ruby-2.0.0-p0/bin:/Users/moshem/.rvm/bin:/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/git/bin:/tools:/platforms:/platform-tools

EDIT, my bash_profile

source "`brew --prefix grc`/etc/grc.bashrc"

export PATH=${JAVA_HOME}/bin:$PATH
export PATH="$PATH:$ANDROID_SDK/tools:$ANDROID_SDK/platforms:$ANDROID_SDK/platform-tools:$ANDROID_NDK"

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*

BTW, the /etc/grc.bashrc doesn't seem to exist on my machine. both this line and the rvm line at the end were added by installed scripts


EDIT

moshe-mbp:~ moshem$ rvm pkg install openssl 
Fetching openssl-1.0.1c.tar.gz to /Users/moshem/.rvm/archives
Extracting openssl to /Users/moshem/.rvm/src/openssl-1.0.1c
Configuring openssl in /Users/moshem/.rvm/src/openssl-1.0.1c.
Compiling openssl in /Users/moshem/.rvm/src/openssl-1.0.1c.
Installing openssl to /Users/moshem/.rvm/usr

Please note that it's required to reinstall all rubies:

    rvm reinstall all --force

Updating openssl certificates
moshe-mbp:~ moshem$ openssl version
OpenSSL 1.0.1e 11 Feb 2013


moshe-mbp:~ moshem$ gem source -r http://rubygems.org/
http://rubygems.org/ removed from sources
moshe-mbp:~ moshem$ gem source -a https://rubygems.org/
Error fetching https://rubygems.org/:
    SSL_connect returned=1 errno=0 state=SSLv3 read server key exchange B: bad ecpoint (https://rubygems.org/specs.4.8.gz)
moshe-mbp:~ moshem$ gem install cocoapods
ERROR:  Could not find a valid gem 'cocoapods' (>= 0) in any repository

Source: (StackOverflow)

How do you test a public/private DSA keypair?

Is there an easy way to verify that a given private key matches a given public key? I have a few *.pub, and a few *.key files, and I need to check which go with which.

Again, these are pub/key files, DSA.

I would really prefer a one-liner of some sort...


Source: (StackOverflow)

Unable to find the wrapper "https" - did you forget to enable it when you configured PHP?

The problem is in the question. I've done a thorough investigation for solutions in regards to this and I know there are topics to this and I've followed them too and nothing has worked. That being said I'll list out exactly everything I've done so far. I am running PHP 5.2.14 with Zend Debugging on the latest Eclipse version on my Windows XP computer. I have a 1 GB of RAM. I have XAMPP running with Apache, MySQL, and FileZilla installed.

On XAMPP I've done the following (Apache was off during these changes): Clicked on Admin from the XAMPP Control Panel and went to https:// localhost/xampp/. From there I accepted the certs from this line on the welcome page:

For OpenSSL support please use the test certificate with https:// 127.0.0.1 or https:// localhost.

On that same section I checked phpinfo(). Under 'Environment', SERVER["HTTPS"] is on. Under 'Apache Environment', HTTPS is On. Under 'PHP Variables, _SERVER["HTTPS"] is On. Under 'Phar', OpenSSL support is disabled (install ext/openssl). I don't know how to enable the Phar one.

Now regarding the files themselves in C:\xampp, I went to the PHP folder. Under both production and development php.ini files (better safe than sorry), I have allow_url_fopen=On, allow_url_include=On, and I removed the semicolon, so that extension=php_openssl.dll is no longer commented out. I even confirmed that the .dll is in the ext folder of the PHP folder. Both libeay32.dll and ssleay32.dll are in the PHP and Apache folders. The Apache folder doesn't contain either productive or development php.ini files.

I've went to http://www.slproweb.com/products/Win32OpenSSL.html and installed Win32 OpenSSL v1.0.0d for safe measure.

Now the line of code in question in my retrieve_website.php looks like this:

$urlquery = "https://www.googleapis.com/customsearch/v1?key=".$appid."&cx=".$google_searchid."&q=".$query."&alt=atom&num=".$results;
$xmlresults = file_get_contents($urlquery);

I have two other websites that I query but they are served via HTTP and they work fine. I also have this line of code entered near the end of the script:

echo 'openssl: ',  extension_loaded  ('openssl') ? 'yes':'no', "\n";
echo 'http wrapper: ', in_array('http', $w) ? 'yes':'no', "\n";
echo 'https wrapper: ', in_array('https', $w) ? 'yes':'no', "\n";
echo 'wrappers: ', var_dump($w);

When I run it as a PHP Script on Eclipse, everything outputs perfectly fine the way I want along with these results:

openssl: yes
http wrapper: yes
https wrapper: yes
wrappers: array(10) {
  [0]=>
  string(5) "https"
  [1]=>
  string(4) "ftps"
  [2]=>
  string(3) "php"
  [3]=>
  string(4) "file"
  [4]=>
  string(4) "data"
  [5]=>
  string(4) "http"
  [6]=>
  string(3) "ftp"
  [7]=>
  string(13) "compress.zlib"
  [8]=>
  string(14) "compress.bzip2"
  [9]=>
  string(3) "zip"
}

Despite all these changes I've made (after I started up Apache), I still get the same errors the first time I access my PHP script in Eclipse and Firefox via http://localhost/tutorial/retrieve_website.php:

Warning: file_get_contents() [function.file-get-contents]: Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in C:\xampp\htdocs\tutorial\retrieve_website.php on line 29

Warning: file_get_contents(https:// www.googleapis.com/customsearch/v1?key=removed API ID&cx=removed search ID&q=The+Devil+went+down+to+Georgia&alt=atom&num=5) [function.file-get-contents]: failed to open stream: No such file or directory in C:\xampp\htdocs\tutorial\retrieve_website.php on line 29

Warning: DOMDocument::loadXML() [domdocument.loadxml]: Empty string supplied as input in C:\xampp\htdocs\tutorial\retrieve_website.php on line 33

openssl: no http wrapper: yes https wrapper: no wrappers: array(10) { [0]=> string(3) "php" [1]=> string(4) "file" [2]=> string(4) "glob" [3]=> string(4) "data" [4]=> string(4) "http" [5]=> string(3) "ftp" [6]=> string(3) "zip" [7]=> string(13) "compress.zlib" [8]=> string(14) "compress.bzip2" [9]=> string(4) "phar" }

What is it that I have overlooked or failed to do? To my own knowledge, I've done everything that I've researched about concerning HTTPS and OpenSSL


Source: (StackOverflow)

Converting a Java Keystore into PEM Format

I am trying to convert from a Java keystore file into a PEM file using keytool and openssl applicactions. But I could not find a good way to do the conversion. Any ideas?

Instead of converting the keystore directly into PEM I tried to create a PKCS12 file first and then convert into relevant PEM file and Keystore. But I could not establish a connection using them. (Note that I just need a PEM file and a Keystore file to implement a secured connection. There is no restriction like "Start from a java keystore file". :) So starting from other formats is acceptable with my case)

But a direct conversion method from jks to pem is preferable.


Source: (StackOverflow)