Skip to content

Commit

Permalink
Remove null byte from PEM files (#3885)
Browse files Browse the repository at this point in the history
  • Loading branch information
eddyashton authored May 25, 2022
1 parent 31fe749 commit 722c8f9
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .daily_canary
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Nice rice
Nice rice, mice
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

### Changed

- Node and service PEM certificates no longer contain a trailing null byte.

### Added

- The node-to-node interface configuration now supports a `published_address` to enable networks with nodes running in different (virtual) subnets (#3867).
Expand Down
3 changes: 1 addition & 2 deletions include/ccf/crypto/pem.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ namespace crypto

size_t size() const
{
// +1 for null termination
return s.size() + 1;
return s.size();
}

bool empty() const
Expand Down
6 changes: 5 additions & 1 deletion tests/infra/consortium.py
Original file line number Diff line number Diff line change
Expand Up @@ -715,8 +715,12 @@ def check_for_service(self, remote_node, status):
os.path.join(self.common_dir, "service_cert.pem")
)

# Certs previously contained a terminating null byte. Strip it for comparison.
current_cert = current_cert.strip("\x00")
expected_cert = expected_cert.strip("\x00")

assert (
current_cert == expected_cert[:-1]
current_cert == expected_cert
), "Current service certificate did not match with service_cert.pem"
assert (
current_status == status.value
Expand Down

0 comments on commit 722c8f9

Please sign in to comment.