MCPcopy Create free account
hub / github.com/apple/foundationdb / PublicKey

Method PublicKey

flow/PKey.cpp:138–153  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

136}
137
138PublicKey::PublicKey(PemEncoded, StringRef pem) {
139 ASSERT(!pem.empty());
140 auto mem = AutoCPointer(::BIO_new_mem_buf(pem.begin(), pem.size()), &::BIO_free);
141 if (!mem)
142 traceAndThrowDecode("PemMemBioInitError");
143 auto key = ::PEM_read_bio_PUBKEY(mem, nullptr, nullptr, nullptr);
144 if (!key)
145 traceAndThrowDecode("PemReadPublicKeyError");
146 ptr = std::shared_ptr<EVP_PKEY>(key, &::EVP_PKEY_free);
147 if (algorithm() == PKeyAlgorithm::UNSUPPORTED) {
148 TraceEvent(SevWarnAlways, "UnsupportedPKeyAlgorithm")
149 .suppressFor(10)
150 .detail("Algorithm", ::OBJ_nid2sn(EVP_PKEY_base_id(ptr.get())));
151 throw pkey_decode_error();
152 }
153}
154
155PublicKey::PublicKey(DerEncoded, StringRef der) {
156 ASSERT(!der.empty());

Callers

nothing calls this directly

Calls 8

AutoCPointerClass · 0.85
traceAndThrowDecodeFunction · 0.85
TraceEventClass · 0.85
detailMethod · 0.80
getMethod · 0.65
emptyMethod · 0.45
beginMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected