/*
- * Copyright 2017 Facebook, Inc.
+ * Copyright 2017-present Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
static std::unique_ptr<IOBuf> derEncode(X509&);
+ /**
+ * Reads certificates from memory and returns them as a vector of X509
+ * pointers.
+ */
+ static std::vector<X509UniquePtr> readCertsFromBuffer(ByteRange);
+
+ /**
+ * Return the output of the X509_digest for chosen message-digest algo
+ * NOTE: The returned digest will be in binary, and may need to be
+ * hex-encoded
+ */
+ static std::array<uint8_t, SHA_DIGEST_LENGTH> getDigestSha1(X509& x509);
+ static std::array<uint8_t, SHA256_DIGEST_LENGTH> getDigestSha256(X509& x509);
+
+ /**
+ * Reads a store from a file (or buffer). Throws on error.
+ */
+ static X509StoreUniquePtr readStoreFromFile(std::string caFile);
+ static X509StoreUniquePtr readStoreFromBuffer(ByteRange);
+
private:
static std::string getDateTimeStr(const ASN1_TIME* time);
};
-}
-}
+} // namespace ssl
+} // namespace folly