Merge pull request #2998 from lateralusX/jlorenss/win-x64-full-aot-support
[mono.git] / mcs / class / System / ReferenceSources / CAPI.cs
1 namespace System.Security.Cryptography {
2
3         static class CAPI {
4                 // OID key type.
5                 internal const uint CRYPT_OID_INFO_OID_KEY   = 1;
6                 internal const uint CRYPT_OID_INFO_NAME_KEY  = 2;
7                 internal const uint CRYPT_OID_INFO_ALGID_KEY = 3;
8                 internal const uint CRYPT_OID_INFO_SIGN_KEY  = 4;
9
10                 public static string CryptFindOIDInfoNameFromKey (string key, OidGroup oidGroup)
11                 {
12                         // TODO: incomplete
13                         // TODO: oidGroup is ignored
14                         switch (key) {
15                         case "1.2.840.113549.1.1.5":
16                         case "1.3.14.3.2.29":
17                         case "1.3.14.3.2.15":
18                                 return "sha1RSA";
19                         case "1.2.840.113549.1.1.4":
20                         case "1.3.14.3.2.3":
21                                 return "md5RSA";
22                         case "1.2.840.10040.4.3":
23                         case "1.3.14.3.2.13":
24                                 return "sha1DSA";
25                         case "1.2.840.113549.1.1.2":
26                         case "1.3.14.7.2.3.1":
27                                 return "md2RSA";
28                         case "1.2.840.113549.1.1.3":
29                                 return "md4RSA";
30                                 return "md4RSA";
31                                 return "md4RSA";
32                         case "1.3.14.3.2.27":
33                                 return "dsaSHA1";
34                         case "2.16.840.1.101.2.1.1.19":
35                                 return "mosaicUpdatedSig";
36                         case "1.3.14.3.2.26":
37                                 return "sha1";
38                         case "1.2.840.113549.2.5":
39                                 return "md5";
40                         case "2.16.840.1.101.3.4.2.1":
41                                 return "sha256";
42                         case "2.16.840.1.101.3.4.2.2":
43                                 return "sha384";
44                         case "2.16.840.1.101.3.4.2.3":
45                                 return "sha512";
46                         case "1.2.840.113549.1.1.11":
47                                 return "sha256RSA";
48                         case "1.2.840.113549.1.1.12":
49                                 return "sha384RSA";
50                         case "1.2.840.113549.1.1.13":
51                                 return "sha512RSA";
52                         case "1.2.840.113549.1.1.10":
53                                 return "RSASSA-PSS";
54                         case "1.2.840.10045.4.1":
55                                 return "sha1ECDSA";
56                         case "1.2.840.10045.4.3.2":
57                                 return "sha256ECDSA";
58                         case "1.2.840.10045.4.3.3":
59                                 return "sha384ECDSA";
60                         case "1.2.840.10045.4.3.4":
61                                 return "sha512ECDSA";
62                         case "1.2.840.10045.4.3":
63                                 return "specifiedECDSA";
64                         case "1.2.840.113549.1.1.1":
65                                 return "RSA";
66                         case "1.2.840.113549.1.7.1":
67                                 return "PKCS 7 Data";
68                         case "1.2.840.113549.1.9.3":
69                                 return "Content Type";
70                         case "1.2.840.113549.1.9.4":
71                                 return "Message Digest";
72                         case "1.2.840.113549.1.9.5":
73                                 return "Signing Time";
74                         case "1.2.840.113549.3.7":
75                                 return "3des";
76                         case "2.5.29.17":
77                                 return "Subject Alternative Name";
78                         case "2.16.840.1.101.3.4.1.2":
79                                 return "aes128";
80                         case "2.16.840.1.101.3.4.1.42":
81                                 return "aes256";
82                         case "2.16.840.1.113730.1.1":
83                                 return "Netscape Cert Type";
84                         }
85
86                         return null;
87                 }
88
89                 public static string CryptFindOIDInfoKeyFromName (string name, OidGroup oidGroup)
90                 {
91                         // TODO: incomplete
92                         // TODO: oidGroup is ignored                    
93                         switch(name) {
94                         case "sha1RSA":
95                                 return "1.2.840.113549.1.1.5";
96                         case "md5RSA":
97                                 return "1.2.840.113549.1.1.4";
98                         case "sha1DSA":
99                                 return "1.2.840.10040.4.3";
100                         case "shaRSA":
101                                 return "1.3.14.3.2.29";
102                         case "md2RSA":
103                                 return "1.2.840.113549.1.1.2";
104                         case "md4RSA":
105                                 return "1.2.840.113549.1.1.3";
106                         case "dsaSHA1":
107                                 return "1.3.14.3.2.27";
108                         case "mosaicUpdatedSig":
109                                 return "2.16.840.1.101.2.1.1.19";
110                         case "sha1":
111                                 return "1.3.14.3.2.26";
112                         case "md5":
113                                 return "1.2.840.113549.2.5";
114                         case "sha256":
115                                 return "2.16.840.1.101.3.4.2.1";
116                         case "sha384":
117                                 return "2.16.840.1.101.3.4.2.2";
118                         case "sha512":
119                                 return "2.16.840.1.101.3.4.2.3";
120                         case "sha256RSA":
121                                 return "1.2.840.113549.1.1.11";
122                         case "sha384RSA":
123                                 return "1.2.840.113549.1.1.12";
124                         case "sha512RSA":
125                                 return "1.2.840.113549.1.1.13";
126                         case "RSASSA-PSS":
127                                 return "1.2.840.113549.1.1.10";
128                         case "sha1ECDSA":
129                                 return "1.2.840.10045.4.1";
130                         case "sha256ECDSA":
131                                 return "1.2.840.10045.4.3.2";
132                         case "sha384ECDSA":
133                                 return "1.2.840.10045.4.3.3";
134                         case "sha512ECDSA":
135                                 return "1.2.840.10045.4.3.4";
136                         case "specifiedECDSA":
137                                 return "1.2.840.10045.4.3";
138                         case "RSA":
139                                 return "1.2.840.113549.1.1.1";
140                         case "PKCS 7 Data":
141                                 return "1.2.840.113549.1.7.1";
142                         case "Content Type":
143                                 return "1.2.840.113549.1.9.3";
144                         case "Message Digest":
145                                 return "1.2.840.113549.1.9.4";
146                         case "Signing Time":
147                                 return "1.2.840.113549.1.9.5";
148                         case "3des":
149                                 return "1.2.840.113549.3.7";
150                         case "Subject Alternative Name":
151                                 return "2.5.29.17";
152                         case "aes128":
153                                 return "2.16.840.1.101.3.4.1.2";
154                         case "aes256":
155                                 return "2.16.840.1.101.3.4.1.42";
156                         case "Netscape Cert Type":
157                                 return "2.16.840.1.113730.1.1";
158                         }
159                         return null;
160                 }
161         }
162 }