0

I have this list of digest + algorithms:

"ECDSA+SHA384:ECDSA+SHA512:RSA+SHA384:RSA+SHA512".

Is there any proper way to convert this string into a list of OpenSSL NIDs?

As a result I would like to have:

  std::list<int> supportedSignatureAlgorithms = { 
    NID_ecdsa_with_SHA384, NID_ecdsa_with_SHA512, 
    NID_sha384WithRSAEncryption, NID_sha512WithRSAEncryption };

For NID values see (for example): https://boringssl.googlesource.com/boringssl/+/HEAD/include/openssl/nid.h

Alexis Wilke
  • 19,179
  • 10
  • 84
  • 156
René Heuven
  • 197
  • 16
  • Tokenize your string with the delimiter `':'` and write a `std::map` such that `map["ECDSA+SHA384"] = NID_ecdsa_with_SHA384`, etc. Any "proper" mapping, according to the linked header, would probably use `"ecdsa-with-SHA384"` as the key. You want your own name, map it yourself. – Useless Oct 13 '22 at 14:57

0 Answers0