Browse Source

extract issuer name

pull/118/head
orignal 10 years ago
parent
commit
2b093a0e3f
  1. 22
      Reseed.cpp

22
Reseed.cpp

@ -365,17 +365,35 @@ namespace data
CryptoPP::BERSequenceDecoder tbsCert (x509Cert); CryptoPP::BERSequenceDecoder tbsCert (x509Cert);
// version // version
uint32_t ver; uint32_t ver;
CryptoPP::BERGeneralDecoder context (tbsCert, 0xa0); CryptoPP::BERGeneralDecoder context (tbsCert, CryptoPP::CONTEXT_SPECIFIC | CryptoPP::CONSTRUCTED);
CryptoPP::BERDecodeUnsigned<uint32_t>(context, ver, CryptoPP::INTEGER); CryptoPP::BERDecodeUnsigned<uint32_t>(context, ver, CryptoPP::INTEGER);
LogPrint (eLogInfo, ver);
// serial // serial
CryptoPP::Integer serial; CryptoPP::Integer serial;
serial.BERDecode(tbsCert); serial.BERDecode(tbsCert);
// signature // signature
CryptoPP::BERSequenceDecoder signature (tbsCert); CryptoPP::BERSequenceDecoder signature (tbsCert);
signature.SkipAll(); signature.SkipAll();
// issuer // issuer
CryptoPP::BERSequenceDecoder issuer (tbsCert); CryptoPP::BERSequenceDecoder issuer (tbsCert);
{
CryptoPP::BERSetDecoder c (issuer); c.SkipAll();
CryptoPP::BERSetDecoder st (issuer); st.SkipAll();
CryptoPP::BERSetDecoder l (issuer); l.SkipAll();
CryptoPP::BERSetDecoder o (issuer); o.SkipAll();
CryptoPP::BERSetDecoder ou (issuer); ou.SkipAll();
CryptoPP::BERSetDecoder cn (issuer);
{
CryptoPP::BERSequenceDecoder attributes (cn);
{
CryptoPP::BERGeneralDecoder ident(attributes, CryptoPP::OBJECT_IDENTIFIER);
ident.SkipAll ();
std::string name;
CryptoPP::BERDecodeTextString (attributes, name, CryptoPP::UTF8_STRING);
LogPrint (eLogInfo, "Issuer name: ", name);
}
}
}
issuer.SkipAll(); issuer.SkipAll();
// validity // validity
CryptoPP::BERSequenceDecoder validity (tbsCert); CryptoPP::BERSequenceDecoder validity (tbsCert);

Loading…
Cancel
Save