Guest User

Untitled

a guest
Oct 22nd, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. X509Certificate2 GetCertificate(string templateId)
  2. {
  3. if (_certificateContainer == null)
  4. return null;
  5.  
  6. if (templateId.IsNullOrWhiteSpace())
  7. return _certificateContainer.DefaultCertificate;
  8.  
  9. var path = _knowledgeManager.GetFullPathById(templateId);
  10.  
  11. return _certificateContainer.Certificates
  12. .Where(c => path.Contains(c.Key) && c.Key.IsNullOrWhiteSpace().Not())
  13. .DefaultIfEmpty(new KeyValuePair<string, X509Certificate2>("", _certificateContainer.DefaultCertificate))
  14. .FirstOrDefault().Value;
  15. }
Add Comment
Please, Sign In to add comment