Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1118)

Side by Side Diff: net/cert/sha256_legacy_support_win.cc

Issue 992733002: Remove //net (except for Android test stuff) and sdch (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/cert/sha256_legacy_support_win.h ('k') | net/cert/sha256_legacy_support_win_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "net/cert/sha256_legacy_support_win.h"
6
7 namespace net {
8
9 namespace sha256_interception {
10
11 bool IsSupportedSubjectType(DWORD subject_type) {
12 switch (subject_type) {
13 case CRYPT_VERIFY_CERT_SIGN_SUBJECT_BLOB:
14 case CRYPT_VERIFY_CERT_SIGN_SUBJECT_CERT:
15 case CRYPT_VERIFY_CERT_SIGN_SUBJECT_CRL:
16 return true;
17 }
18 return false;
19 }
20
21 bool IsSupportedIssuerType(DWORD issuer_type) {
22 switch (issuer_type) {
23 case CRYPT_VERIFY_CERT_SIGN_ISSUER_PUBKEY:
24 case CRYPT_VERIFY_CERT_SIGN_ISSUER_CERT:
25 case CRYPT_VERIFY_CERT_SIGN_ISSUER_CHAIN:
26 return true;
27 }
28 return false;
29 }
30
31 base::StringPiece GetSubjectSignature(DWORD subject_type,
32 void* subject_data) {
33 switch (subject_type) {
34 case CRYPT_VERIFY_CERT_SIGN_SUBJECT_BLOB: {
35 CRYPT_DATA_BLOB* data_blob =
36 reinterpret_cast<CRYPT_DATA_BLOB*>(subject_data);
37 return base::StringPiece(reinterpret_cast<char*>(data_blob->pbData),
38 data_blob->cbData);
39 }
40 case CRYPT_VERIFY_CERT_SIGN_SUBJECT_CERT: {
41 PCCERT_CONTEXT subject_cert =
42 reinterpret_cast<PCCERT_CONTEXT>(subject_data);
43 return base::StringPiece(
44 reinterpret_cast<char*>(subject_cert->pbCertEncoded),
45 subject_cert->cbCertEncoded);
46 }
47 case CRYPT_VERIFY_CERT_SIGN_SUBJECT_CRL: {
48 PCCRL_CONTEXT subject_crl =
49 reinterpret_cast<PCCRL_CONTEXT>(subject_data);
50 return base::StringPiece(
51 reinterpret_cast<char*>(subject_crl->pbCrlEncoded),
52 subject_crl->cbCrlEncoded);
53 }
54 }
55 return base::StringPiece();
56 }
57
58 PCERT_PUBLIC_KEY_INFO GetIssuerPublicKey(DWORD issuer_type,
59 void* issuer_data) {
60 switch (issuer_type) {
61 case CRYPT_VERIFY_CERT_SIGN_ISSUER_PUBKEY:
62 return reinterpret_cast<PCERT_PUBLIC_KEY_INFO>(issuer_data);
63 case CRYPT_VERIFY_CERT_SIGN_ISSUER_CERT: {
64 PCCERT_CONTEXT cert = reinterpret_cast<PCCERT_CONTEXT>(issuer_data);
65 return &cert->pCertInfo->SubjectPublicKeyInfo;
66 }
67 case CRYPT_VERIFY_CERT_SIGN_ISSUER_CHAIN: {
68 PCCERT_CHAIN_CONTEXT chain =
69 reinterpret_cast<PCCERT_CHAIN_CONTEXT>(issuer_data);
70 PCCERT_CONTEXT cert = chain->rgpChain[0]->rgpElement[0]->pCertContext;
71 return &cert->pCertInfo->SubjectPublicKeyInfo;
72 }
73 }
74 return NULL;
75 }
76
77 } // namespace sha256_interception
78
79 } // namespace net
OLDNEW
« no previous file with comments | « net/cert/sha256_legacy_support_win.h ('k') | net/cert/sha256_legacy_support_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698