Fixed moved cert x509 function issue on Windows
This commit is contained in:
		
					parent
					
						
							
								89c1b8043f
							
						
					
				
			
			
				commit
				
					
						a723e5a4c5
					
				
			
		
					 1 changed files with 4 additions and 5 deletions
				
			
		| 
						 | 
					@ -9,6 +9,7 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "base/callback.h"
 | 
					#include "base/callback.h"
 | 
				
			||||||
#include "net/cert/cert_database.h"
 | 
					#include "net/cert/cert_database.h"
 | 
				
			||||||
 | 
					#include "net/cert/x509_util_win.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace certificate_trust {
 | 
					namespace certificate_trust {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -68,12 +69,12 @@ void ShowCertificateTrust(atom::NativeWindow* parent_window,
 | 
				
			||||||
                          const ShowTrustCallback& callback) {
 | 
					                          const ShowTrustCallback& callback) {
 | 
				
			||||||
  PCCERT_CHAIN_CONTEXT chain_context;
 | 
					  PCCERT_CHAIN_CONTEXT chain_context;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  auto cert_context = cert->CreateOSCertChainForCert();
 | 
					  auto cert_context = net::x509_util::CreateCertContextWithChain(cert.get());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  auto params = GetCertificateChainParameters();
 | 
					  auto params = GetCertificateChainParameters();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (CertGetCertificateChain(NULL,
 | 
					  if (CertGetCertificateChain(NULL,
 | 
				
			||||||
                              cert_context,
 | 
					                              cert_context.get(),
 | 
				
			||||||
                              NULL,
 | 
					                              NULL,
 | 
				
			||||||
                              NULL,
 | 
					                              NULL,
 | 
				
			||||||
                              ¶ms,
 | 
					                              ¶ms,
 | 
				
			||||||
| 
						 | 
					@ -84,14 +85,12 @@ void ShowCertificateTrust(atom::NativeWindow* parent_window,
 | 
				
			||||||
    if (error_status == CERT_TRUST_IS_SELF_SIGNED ||
 | 
					    if (error_status == CERT_TRUST_IS_SELF_SIGNED ||
 | 
				
			||||||
        error_status == CERT_TRUST_IS_UNTRUSTED_ROOT) {
 | 
					        error_status == CERT_TRUST_IS_UNTRUSTED_ROOT) {
 | 
				
			||||||
      // these are the only scenarios we're interested in supporting
 | 
					      // these are the only scenarios we're interested in supporting
 | 
				
			||||||
      AddToTrustedRootStore(cert_context, cert);
 | 
					      AddToTrustedRootStore(cert_context.get(), cert);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    CertFreeCertificateChain(chain_context);
 | 
					    CertFreeCertificateChain(chain_context);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  CertFreeCertificateContext(cert_context);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  callback.Run();
 | 
					  callback.Run();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue