<commit_before>## SSL Check

An easy way to verify the installation of SSL certificates.

[![Build Status](https://travis-ci.org/clayton/sslcheck.svg?branch=master)](https://travis-ci.org/clayton/sslcheck)
[![Code Climate](https://codeclimate.com/github/clayton/sslcheck/badges/gpa.svg)](https://codeclimate.com/github/clayton/sslcheck)

## Installation

Install the gem on your system

```
  gem install sslcheck
```

Use the gem with bundler by adding the following to your `Gemfile`

```
  gem "sslcheck"
```

## Using SSLCheck

The SSLCheck gem has a simple API.

First create a check:

```
  check = SSLCheck::Checker.new
```

Then, check a url:

```
  check.check("github.com")
```

Is the certificate valid?

```
  check.valid?
  => true
```

Are there any errors?

```
  check.errors
  => []
```

## Timeouts

By default, connections to verify a certificate will timeout after 30 seconds. To
change this behavior, specify your own timeout, in seconds, on the `SSLCheck::Client`
class.

```
  SSLCheck::Client.timeout_seconds = 10  # A 10 second timeout
  check = SSLCheck::Checker.new
  check.check("github.com")
```

What are the details of the certificate?

The peer certificate found during the check is available with a rich
(undocumented) API. See `SSLCheck::Certificate` for more details. A helper
method is provided on the `Certificate` to get at most of the important details.

```
  checker.peer_cert.to_h
  {:common_name=>"letsencrypt.org",
   :organization_unit=>"Domain Control Validated",
   :not_before=>
    #<DateTime: 2014-07-25T00:00:00+00:00 ((2456864j,0s,0n),+0s,2299161j)>,
   :not_after=>
    #<DateTime: 2015-07-25T23:59:59+00:00 ((2457229j,86399s,0n),+0s,2299161j)>,
   :issued=>true,
   :expired=>false,
   :issuer=>
    {:common_name=>"COMODO RSA Domain Validation Secure Server CA",
     :country=>"GB",
     :state=>"Greater Manchester",
     :locality=>"Salford",
     :organization=>"COMODO CA Limited"}}
  => {:common_name=>"letsencrypt.org", :organization_unit=>"Domain Control Validated", :not_before=>#<DateTime: 2014-07-25T00:00:00+00:00 ((2456864j,0s,0n),+0s,2299161j)>, :not_after=>#<DateTime: 2015-07-25T23:59:59+00:00 ((2457229j,86399s,0n),+0s,2299161j)>, :issued=>true, :expired=>false, :issuer=>{:common_name=>"COMODO RSA Domain Validation Secure Server CA", :country=>"GB", :state=>"Greater Manchester", :locality=>"Salford", :organization=>"COMODO CA Limited"}}
```

What are the details of the CA Bundle?
<commit_msg>clarify checker usage in readme<commit_after>## SSL Check

An easy way to verify the installation of SSL certificates.

[![Build Status](https://travis-ci.org/clayton/sslcheck.svg?branch=master)](https://travis-ci.org/clayton/sslcheck)
[![Code Climate](https://codeclimate.com/github/clayton/sslcheck/badges/gpa.svg)](https://codeclimate.com/github/clayton/sslcheck)

## Installation

Install the gem on your system

```
  gem install sslcheck
```

Use the gem with bundler by adding the following to your `Gemfile`

```
  gem "sslcheck"
```

## Using SSLCheck

The SSLCheck gem has a simple API.

First create a Checker:

```
  checker = SSLCheck::Checker.new
```

Then, check a url:

```
  checker.check("github.com")
```

Is the certificate valid?

```
  checker.valid?
  => true
```

Are there any errors?

```
  checker.errors
  => []
```

## Timeouts

By default, connections to verify a certificate will timeout after 30 seconds. To
change this behavior, specify your own timeout, in seconds, on the `SSLCheck::Client`
class.

```
  SSLCheck::Client.timeout_seconds = 10  # A 10 second timeout
  checker = SSLCheck::Checker.new
  checker.check("github.com")
```

What are the details of the certificate?

The peer certificate found during the check is available with a rich
(undocumented) API. See `SSLCheck::Certificate` for more details. A helper
method is provided on the `Certificate` to get at most of the important details.

```
  checker.peer_cert.to_h
  {:common_name=>"letsencrypt.org",
   :organization_unit=>"Domain Control Validated",
   :not_before=>
    #<DateTime: 2014-07-25T00:00:00+00:00 ((2456864j,0s,0n),+0s,2299161j)>,
   :not_after=>
    #<DateTime: 2015-07-25T23:59:59+00:00 ((2457229j,86399s,0n),+0s,2299161j)>,
   :issued=>true,
   :expired=>false,
   :issuer=>
    {:common_name=>"COMODO RSA Domain Validation Secure Server CA",
     :country=>"GB",
     :state=>"Greater Manchester",
     :locality=>"Salford",
     :organization=>"COMODO CA Limited"}}
  => {:common_name=>"letsencrypt.org", :organization_unit=>"Domain Control Validated", :not_before=>#<DateTime: 2014-07-25T00:00:00+00:00 ((2456864j,0s,0n),+0s,2299161j)>, :not_after=>#<DateTime: 2015-07-25T23:59:59+00:00 ((2457229j,86399s,0n),+0s,2299161j)>, :issued=>true, :expired=>false, :issuer=>{:common_name=>"COMODO RSA Domain Validation Secure Server CA", :country=>"GB", :state=>"Greater Manchester", :locality=>"Salford", :organization=>"COMODO CA Limited"}}
```

What are the details of the CA Bundle?

{'fraction_non_alphanumeric': 0.15653923541247486, 'fraction_numerical': 0.061971830985915494, 'mean_word_length': 5.175155279503105, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 65, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5668840', 'n_tokens_mistral': 1974, 'n_tokens_neox': 1733, 'n_words': 432}