Skip to content

Conversation

@benoitc
Copy link
Owner

@benoitc benoitc commented Jan 19, 2026

Summary

  • Add hackney:peercert/1 function to retrieve the DER-encoded peer SSL certificate
  • Returns {ok, Cert} for SSL connections, {error, not_ssl} for non-SSL, {error, not_connected} if disconnected
  • Implemented in hackney_ssl, hackney_conn, and hackney modules

Fixes #599

Add hackney:peercert/1 function that returns the DER-encoded peer
certificate for SSL connections, similar to how peername/1 returns
the peer address.

The function returns:
- {ok, Cert} where Cert is the DER-encoded certificate binary
- {error, not_ssl} for non-SSL connections
- {error, not_connected} if there's no active connection

Fixes #599
@benoitc benoitc merged commit 1aa5945 into master Jan 19, 2026
5 checks passed
@benoitc benoitc deleted the feat/599-peercert branch January 19, 2026 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add peercert/1 function like peername/1

2 participants