1 /*---------------------------------------------------------------------------*
2   Project:  Horizon
3   File:     nssl_restricted.h
4 
5   Copyright (C)2009 Nintendo Co., Ltd.  All rights reserved.
6 
7   These coded instructions, statements, and computer programs contain
8   proprietary information of Nintendo of America Inc. and/or Nintendo
9   Company Ltd., and are protected by Federal copyright law.  They may
10   not be disclosed to third parties or copied or duplicated in any form,
11   in whole or in part, without the prior written consent of Nintendo.
12 
13   $Rev: 28581 $
14  *---------------------------------------------------------------------------*/
15 
16 #ifndef __NSSL_RESTRICTED_H__
17 #define __NSSL_RESTRICTED_H__
18 
19 #ifdef  __cplusplus
20 extern "C" {
21 #endif  // __cplusplus
22 
23 /*---------------------------------------------------------------------------*
24  * Includes
25  *---------------------------------------------------------------------------*/
26 
27 #include <nos.h>
28 
29 /*---------------------------------------------------------------------------*
30  * Definitions
31  *---------------------------------------------------------------------------*/
32 #define NSSL_MAX_SSLCERT_NAME_BUF_LEN            256 /* NSSLCertInfoでのみ使用 */
33 
34 /* errors that are set in verifyCB() */
35 #define NSSL_VERIFYERRORS_COMMON_NAME            0x01
36 #define NSSL_VERIFYERRORS_ROOT_CA                0x02
37 #define NSSL_VERIFYERRORS_DATE                   0x04
38 #define NSSL_VERIFYERRORS_CHAIN                  0x08
39 #define NSSL_VERIFYERRORS_REVOKED_CERT           0x20
40 #define NSSL_VERIFYERRORS_USER                   0x40
41 #define NSSL_VERIFYERRORS_EV                     0x80
42 
43 #define NSSL_CPS_URI_LENGTH                      256
44 
45 /*---------------------------------------------------------------------------*
46  * EV Policy ID
47  *---------------------------------------------------------------------------*/
48 #define NSSL_EVID_COMODO             "1.3.6.1.4.1.6449.1.2.1.5.1"
49 #define NSSL_EVID_CYBERTRUST         "1.3.6.1.4.1.6334.1.100.1"
50 #define NSSL_EVID_DIGICERT           "2.16.840.1.114412.2.1"
51 #define NSSL_EVID_DIGINOTAR          "2.16.528.1.1001.1.1.1"
52 #define NSSL_EVID_ENTRUST            "2.16.840.1.114028.10.1.2"
53 #define NSSL_EVID_GEOTRUST           "1.3.6.1.4.1.14370.1.6"
54 #define NSSL_EVID_GLOBALSIGN         "1.3.6.1.4.1.4146.1.1"
55 #define NSSL_EVID_GODADDY            "2.16.840.1.114413.1.7.23.3"
56 #define NSSL_EVID_NETWORKSOLUTIONS   "1.3.6.1.4.1.782.1.2.1.8.1"
57 #define NSSL_EVID_QUOVADIS           "1.3.6.1.4.1.8024.0.2.100.1.2"
58 #define NSSL_EVID_SECOM              "1.2.392.200091.100.731.1"
59 #define NSSL_EVID_STARFIELD          "2.16.840.1.114414.1.7.23.3"
60 #define NSSL_EVID_SWISSSIGN          "2.16.756.1.89.1.2.1.1"
61 #define NSSL_EVID_THAWTE             "2.16.840.1.113733.1.7.48.1"
62 #define NSSL_EVID_TRUSTWAVE          "2.16.840.1.114404.1.1.2.4.1"
63 #define NSSL_EVID_VERISIGN           "2.16.840.1.113733.1.7.23.6"
64 
65 /*---------------------------------------------------------------------------*
66  * Types/Declarations
67  *---------------------------------------------------------------------------*/
68 
69 typedef struct NSSLCertInfo {
70     char subjectName[NSSL_MAX_SSLCERT_NAME_BUF_LEN];
71     char issuerName[NSSL_MAX_SSLCERT_NAME_BUF_LEN];
72     u8* serialNumber; // bigendian byte stream
73     u32 serialNumberSize;
74     u32 notBefore; // seconds
75     u32 notAfter;  // seconds
76     u8 fingerPrint[20];
77 
78     BOOL isEV;
79     u8 cpsURI[NSSL_CPS_URI_LENGTH];
80 
81 } NSSLCertInfo;
82 
83 typedef BOOL (*NSSLVerifyCallback)( u32 errors,
84                                     const NSSLCertInfo* serverCertInfo,
85                                     const NSSLCertInfo* rootCACertInfo,
86                                     void* userArg );
87 
88 /*---------------------------------------------------------------------------*
89  * Function Prototypes
90  *---------------------------------------------------------------------------*/
91 s32     NSSL_SetVerifyCallback    ( NSSLId sslId, NSSLVerifyCallback verifyCallback, void* userArg );
92 s32     NSSL_AddEVPolicyId(NSSLId sslId, char *policyId);
93 
94 #ifdef  __cplusplus
95 }
96 #endif  // __cplusplus
97 #endif  // __NSSL_RESTRICTED_H__
98