-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathIPolicy.cs
176 lines (167 loc) · 8.51 KB
/
IPolicy.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
// Copyright (c) Uwe Gradenegger <[email protected]>
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using TameMyCerts.WSTEP.Models.MS_XCEP;
namespace TameMyCerts.WSTEP;
[ServiceContract(Namespace = "http://schemas.microsoft.com/windows/pki/2009/01/enrollmentpolicy")]
public interface IPolicy
{
[OperationContract(
Action = "http://schemas.microsoft.com/windows/pki/2009/01/enrollmentpolicy/IPolicy/GetPolicies",
ReplyAction = "http://schemas.microsoft.com/windows/pki/2009/01/enrollmentpolicy/IPolicy/GetPoliciesResponse",
Name = "GetPoliciesResponse")]
Message GetPolicies(Message message);
}
public class Policy : IPolicy
{
public Message GetPolicies(Message message)
{
// just to ensure the input is valid
_ = GetPoliciesType.FromMessage(message);
var response = new GetPoliciesResponseType
{
Response = new ResponseType
{
PolicyId = "{47177453-8EE0-4739-9B73-F40626A42D51}",
CertificateEnrollmentPolicyCollection = new List<CertificateEnrollmentPolicyType>
{
new()
{
PolicyOidReference = 0,
CaReferenceCollection = new List<int> { 0 },
Attributes = new AttributesType
{
CommonName = "User_Online",
PolicySchema = 2,
CertificateValidity = new CertificateValidityType
{
ValidityPeriodSeconds = 31536000,
RenewalPeriodSeconds = 3628800
},
Permission = new EnrollmentPermissionType
{
Enroll = true,
AutoEnroll = true
},
PrivateKeyAttributes = new PrivateKeyAttributesType
{
MinimalKeyLength = 2048,
KeySpec = 1,
CryptoProviders = new List<string>
{
"Microsoft Enhanced Cryptographic Provider v1.0",
"Microsoft Base Cryptographic Provider v1.0"
}
},
Revision = new RevisionType
{
MajorRevision = 100,
MinorRevision = 8
},
PrivateKeyFlags = 50528256,
SubjectNameFlags = 1107296256,
EnrollmentFlags = 0,
GeneralFlags = 131642,
Extensions = new List<ExtensionType>
{
new()
{
OIdReference = 2,
Value = "MC8GJysGAQQBgjcVCITLq2yCk8xwhamPMobR/COC8YBmgVuBmL0JhYaHHgIBZAIBCA=="
},
new()
{
OIdReference = 3,
Value = "MAoGCCsGAQUFBwMC"
},
new()
{
OIdReference = 4,
Critical = true,
Value = "AwIFoA=="
},
new()
{
OIdReference = 5,
Value = "MAwwCgYIKwYBBQUHAwI="
}
}
}
}
}
},
CaCollection = new List<CaType>
{
new()
{
Uris = new List<CaUriType>
{
new()
{
ClientAuthentication = 2,
Uri = "https://fbweb02.forest-b.local/wstep/Service.svc/CES",
Priority = 1,
}
},
Certificate =
"MIIFYzCCA0ugAwIBAgIQHLPS2yhxVYFO1BnhmncQSDANBgkqhkiG9w0BAQsFADBDMRUwEwYKCZImiZPyLGQBGRYFbG9jYWwxGDAWBgoJkiaJk/IsZAEZFghmb3Jlc3QtYTEQMA4GA1UEAxMHVEVTVC1DQTAgFw0yMzExMzAwODU3MzZaGA8yMDczMTEzMDA5MDczNVowQzEVMBMGCgmSJomT8ixkARkWBWxvY2FsMRgwFgYKCZImiZPyLGQBGRYIZm9yZ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Aaqjed+RJ2Cw+QUJtSkuz1VS5wDwE8+Uu6mzEeEGa1z4cf+qO6Y0kPIB2clPW78a+nGTe6jQzEM5+m5OxPuq4yWjXoilRrnW6iOcfbTEcJoTQvg/6/DdLAtkeKFIAtUjflo8v3cv37IsQDyEtNuLO3GcnRSTIr5FIeYq5tZ+qZU1NDvf+CkzuH0gq7EniON5KSv7vOQZ/9d1DtITJ7ubxYLbiBIOpfwEQS5985iJyUdAoGcX7D3UV59GXKH4Ec/MgQa0U7ZIxH7sYGkEZZn7DdgqPy7H400M0rNfttMdFoDH00L6KnNL9SUU2kR/I1H4x4Ees+DEpQJ3hHywwZcz+YE+olDTtf3U1umEnihDPMR7ai2oj/zHDscM/gL5LiqbUQjf3nfK1DSJR8Vs18k1ENyRyqZxyoJcHIOJVlc5d1+vxkJVxlFJwHDBUhZudVLeO0RKpZCtt2IFJDackSrkl1x1UbSerzu7h0L2jF+JHkXtJQMJxbEy3kK6sRF1IdzXC",
EnrollPermission = true,
CaReferenceId = 0
}
},
OidCollection = new List<OidType>
{
new()
{
Value = "1.3.6.1.4.1.311.21.8.9623020.4515440.11159474.13925923.6045798.219.2498185.10584990",
Group = 9,
OIdReferenceId = 0,
DefaultName = "User_Online"
},
new()
{
Value = "1.3.6.1.5.5.7.3.2",
Group = 7,
OIdReferenceId = 1,
DefaultName = "Client Authentication"
},
new()
{
Value = "1.3.6.1.4.1.311.21.7",
Group = 6,
OIdReferenceId = 2,
DefaultName = "Certificate Template Information"
},
new()
{
Value = "2.5.29.37",
Group = 6,
OIdReferenceId = 3,
DefaultName = "Enhanced Key Usage"
},
new()
{
Value = "2.5.29.15",
Group = 6,
OIdReferenceId = 4,
DefaultName = "Key Usage"
},
new()
{
Value = "1.3.6.1.4.1.311.21.10",
Group = 6,
OIdReferenceId = 5,
DefaultName = "Application Policies"
}
}
};
return response.ToMessage();
}
}