Search code examples
certificatesmalltalkx509pharo

x.509 certificate operations with pharo smalltalk


I am very new to smalltalk. I have installed Pharo 5.0 and use the standard image.

I want to create/read x.509 certs in Smalltalk. Searched for and found ZdcPluginSSLSession (which uses SqueakSSL which in turn uses ssleay32.dll/libeay.dll). I understand Zodiac/Zinc can be used to create SSL sessions with certs.

Can anyone tell how to get started with certs on smalltalk. I want to perform operations on certs like create/parse/validate etc. Do I use ssleay32.dll instead ? Where can i get some good docs on FFI to be used with Pharo 5.0?

Thanks in advance.


Solution

  • You can go either the native route using FFI or you could use a smalltalk only approach. For the latter you can load the project from

    http://smalltalkhub.com/#!/~NorbertHartl/X509

    to read certificates. You can load it by opening a playground and executing:

    Metacello new
      configuration: 'X509';
      version: #development;
      repository: 'http://smalltalkhub.com/mc/NorbertHartl/X509/main';
      load.
    

    The implementation there can be used with

    X509 readCertificateFromPEM: '/path/to/pem/file.pem' asFileReference readStream 
    

    The X509 implementation is pretty simple and gives you an idea how to work with the ASN.1 suite included. If you have questions contact me directly. I'm eager to help with it.