Skip to content

feat: add peercert/1 function to get peer SSL certificate (#599)#813

Merged
benoitc merged 1 commit intomasterfrom
feat/599-peercert
Jan 19, 2026
Merged

feat: add peercert/1 function to get peer SSL certificate (#599)#813
benoitc merged 1 commit intomasterfrom
feat/599-peercert

Conversation

@benoitc
Copy link
Copy Markdown
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

1 participant