public void SetCertificate(StoreLocation storeLocation, StoreName storeName, X509FindType findType, object findValue) { if (findValue == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("findValue"); } ThrowIfImmutable(); var dotNetCertificate = SecurityUtils.GetCertificateFromStore(storeName, storeLocation, findType, findValue, null); IReadOnlyList <Certificate> uwpCertificates; try { uwpCertificates = GetCertificatesFromWinRTStore(dotNetCertificate); } catch (Exception) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(SecurityUtils.CreateCertificateLoadException( storeName, storeLocation, findType, findValue, null, 0)); } if (uwpCertificates.Count != 1) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(SecurityUtils.CreateCertificateLoadException( storeName, storeLocation, findType, findValue, null, uwpCertificates.Count)); } AttachUwpCertificate(dotNetCertificate, uwpCertificates[0]); _certificate = dotNetCertificate; }
public void SetCertificate(StoreLocation storeLocation, StoreName storeName, X509FindType findType, object findValue) { if (findValue == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("findValue"); } ThrowIfImmutable(); _certificate = SecurityUtils.GetCertificateFromStore(storeName, storeLocation, findType, findValue, null); }
public void SetScopedCertificate(StoreLocation storeLocation, StoreName storeName, X509FindType findType, object findValue, Uri targetService) { if (findValue == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("findValue"); } if (targetService == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("targetService"); } ThrowIfImmutable(); X509Certificate2 certificate = SecurityUtils.GetCertificateFromStore(storeName, storeLocation, findType, findValue, null); ScopedCertificates[targetService] = certificate; }