Skip to content

Commit

Permalink
Merge pull request #4 from exonet/tsi-EXO-3319
Browse files Browse the repository at this point in the history
Export without the need for a private key
  • Loading branch information
robbinjanssen committed Feb 18, 2019
2 parents 109232d + 861a7bb commit 51c95c0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Expand Up @@ -4,7 +4,12 @@ All notable changes to `SSL converter` will be documented in this file.
Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) principles.

## Unreleased
[Compare v0.0.1 - Unreleased](https://github.com/exonet/ssl-converter/compare/v0.0.1...develop)
[Compare v0.0.2 - Unreleased](https://github.com/exonet/ssl-converter/compare/v0.0.1...develop)

## [v0.0.2](https://github.com/exonet/ssl-converter/releases/tag/v0.0.2) - 2019-02-18
[Compare v0.0.1 - v0.0.2](https://github.com/exonet/ssl-converter/compare/v0.0.1...v0.0.2)
### Changed
- It is now possible to export to "Plain" without a private key.

## [v0.0.1](https://github.com/exonet/ssl-converter/releases/tag/v0.0.1) - 2019-01-30
### Added
Expand Down
16 changes: 11 additions & 5 deletions src/Formats/Plain.php
Expand Up @@ -24,11 +24,17 @@ class Plain extends AbstractFormat
*/
public function export() : array
{
return [
$this->name.'.key' => $this->plainCertificate->getKey(),
$this->name.'.crt' => $this->plainCertificate->getCrt(),
$this->name.'.ca-bundle' => $this->plainCertificate->getCaBundle(),
];
$files = [];

// Add the key only if it is not empty.
if (!empty($this->plainCertificate->getKey())) {
$files[$this->name.'.key'] = $this->plainCertificate->getKey();
}

$files[$this->name.'.crt'] = $this->plainCertificate->getCrt();
$files[$this->name.'.ca-bundle'] = $this->plainCertificate->getCaBundle();

return $files;
}

/**
Expand Down

0 comments on commit 51c95c0

Please sign in to comment.