Skip to content

Commit

Permalink
add getDER() to folly::AsyncTransportCertificate
Browse files Browse the repository at this point in the history
Summary: Some implementations of this cert will need to access a DER representation of the Cert. So adding this to the interface.

Reviewed By: mingtaoy

Differential Revision: D64149926

fbshipit-source-id: f471ef71e042111aba67277cd3b0101e34f92169
  • Loading branch information
Zale Young authored and facebook-github-bot committed Oct 17, 2024
1 parent 7fcb3b8 commit 82e5821
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions fizz/protocol/Certificate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,8 @@ IdentityCert::IdentityCert(std::string identity) : identity_(identity) {}
std::string IdentityCert::getIdentity() const {
return identity_;
}

std::optional<std::string> IdentityCert::getDER() const {
return std::nullopt;
}
} // namespace fizz
3 changes: 3 additions & 0 deletions fizz/protocol/Certificate.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class Cert {
public:
virtual ~Cert() = default;
virtual std::string getIdentity() const = 0;
virtual std::optional<std::string> getDER() const = 0;
};

using SelfCertBase = Cert;
Expand All @@ -55,6 +56,8 @@ class IdentityCert : public IdentityCertBase {

std::string getIdentity() const override;

std::optional<std::string> getDER() const override;

private:
std::string identity_;
};
Expand Down
1 change: 1 addition & 0 deletions fizz/protocol/test/Mocks.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ class MockCert : public Cert {
public:
MOCK_METHOD(std::string, getIdentity, (), (const));
MOCK_METHOD(folly::ssl::X509UniquePtr, getX509, (), (const));
MOCK_METHOD(std::optional<std::string>, getDER, (), (const));
};

class MockSelfCert : public SelfCert {
Expand Down

0 comments on commit 82e5821

Please sign in to comment.