You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// Initializes a new instance of the <see cref="X509Certificate2"/> class using a string with the content of an X.509 certificate.
53
42
/// </summary>
54
43
/// <param name="certificate">A string containing a X.509 certificate.</param>
55
44
/// <remarks>
56
-
/// This methods is exclusive of nanoFramework. The equivalent .NET constructor accepts a file name as the parameter.
45
+
/// This methods is exclusive of .NET nanoFramework. The equivalent .NET constructor accepts a file name as the parameter.
57
46
/// </remarks>
58
47
publicX509Certificate2(stringcertificate)
59
48
:base(certificate)
60
49
{
61
50
}
62
51
63
52
/// <summary>
64
-
/// Initializes a new instance of the <see cref="X509Certificate2"/> class using a string with the content of an X.509 certificate and a password used to access the certificate.
65
-
/// </summary>
66
-
/// <param name="certificate">A string containing a X.509 certificate.</param>
67
-
/// <param name="password">The password required to access the X.509 certificate data.</param>
68
-
/// <remarks>
69
-
/// This methods is exclusive of nanoFramework. The equivalent .NET constructor accepts a file name as the parameter.
/// Initializes a new instance of the <see cref="X509Certificate2"/> class using a string with the content of an X.509 public certificate, the private key and a password used to access the certificate.
53
+
/// Initializes a new instance of the <see cref="X509Certificate2"/> class using a string with the content of an X.509 public certificate, the private key and a password used to access the private key.
78
54
/// </summary>
79
55
/// <param name="rawData">A string containing a X.509 certificate.</param>
80
-
/// <param name="key">A string containing a PEM private key.</param>
81
-
/// <param name="password">The password required to access the X.509 certificate data. Set to <see langword="null"/> if the <paramref name="rawData"/> or <paramref name="key"/> are not encrypted and do not require a password.</param>
56
+
/// <param name="key">A string containing a private key in PEM or DER format.</param>
57
+
/// <param name="password">The password required to decrypt the private key. Set to <see langword="null"/> if the <paramref name="rawData"/> or <paramref name="key"/> are not encrypted and do not require a password.</param>
82
58
/// <remarks>
83
-
/// This methods is exclusive of nanoFramework. There is no equivalent in .NET framework.
59
+
/// This methods is exclusive of .NET nanoFramework. There is no equivalent in .NET framework.
84
60
/// </remarks>
85
61
publicX509Certificate2(
86
62
stringrawData,
87
63
stringkey,
88
64
stringpassword)
89
-
:base(
90
-
rawData,
91
-
password)
65
+
:base(rawData)
92
66
{
93
67
vartempKey=Encoding.UTF8.GetBytes(key);
94
68
@@ -101,26 +75,27 @@ public X509Certificate2(
101
75
keyBuffer[keyBuffer.Length-1]=0;
102
76
103
77
_privateKey=keyBuffer;
78
+
_password=password;
104
79
105
-
DecodePrivateKeyNative(keyBuffer,password);
80
+
DecodePrivateKeyNative(
81
+
keyBuffer,
82
+
password);
106
83
}
107
84
108
85
/// <summary>
109
86
/// Initializes a new instance of the <see cref="X509Certificate2"/> class using a string with the content of an X.509 public certificate, the private key and a password used to access the certificate.
110
87
/// </summary>
111
88
/// <param name="rawData">A byte array containing data from an X.509 certificate.</param>
112
-
/// <param name="key">A string containing a PEM private key.</param>
113
-
/// <param name="password">The password required to access the X.509 certificate data. Set to <see langword="null"/> if the <paramref name="rawData"/> or <paramref name="key"/> are not encrypted and do not require a password.</param>
89
+
/// <param name="key">A string containing a private key in PEM or DER format.</param>
90
+
/// <param name="password">The password required to decrypt the private key. Set to <see langword="null"/> if the <paramref name="rawData"/> or <paramref name="key"/> are not encrypted and do not require a password.</param>
114
91
/// <remarks>
115
-
/// This methods is exclusive of nanoFramework. There is no equivalent in .NET framework.
92
+
/// This methods is exclusive of .NET nanoFramework. There is no equivalent in .NET framework.
116
93
/// </remarks>
117
94
publicX509Certificate2(
118
95
byte[]rawData,
119
96
stringkey,
120
97
stringpassword)
121
-
:base(
122
-
rawData,
123
-
password)
98
+
:base(rawData)
124
99
{
125
100
vartempKey=Encoding.UTF8.GetBytes(key);
126
101
@@ -133,34 +108,38 @@ public X509Certificate2(
133
108
keyBuffer[keyBuffer.Length-1]=0;
134
109
135
110
_privateKey=keyBuffer;
111
+
_password=password;
136
112
137
-
DecodePrivateKeyNative(keyBuffer,password);
113
+
DecodePrivateKeyNative(
114
+
keyBuffer,
115
+
password);
138
116
}
139
117
140
118
/// <summary>
141
119
/// Initializes a new instance of the <see cref="X509Certificate2"/> class using a string with the content of an X.509 public certificate, the private key and a password used to access the certificate.
142
120
/// </summary>
143
121
/// <param name="rawData">A byte array containing data from an X.509 certificate.</param>
144
122
/// <param name="key">A byte array containing a PEM private key.</param>
145
-
/// <param name="password">The password required to access the X.509 certificate data. <see langword="null"/> if the <paramref name="rawData"/> or <paramref name="key"/> are not encrypted.</param>
123
+
/// <param name="password">The password required to decrypt the private key. <see langword="null"/> if the <paramref name="rawData"/> or <paramref name="key"/> are not encrypted.</param>
146
124
/// <remarks>
147
125
/// This methods is exclusive of nanoFramework. There is no equivalent in .NET framework.
148
126
/// </remarks>
149
127
publicX509Certificate2(
150
128
byte[]rawData,
151
129
byte[]key,
152
130
stringpassword)
153
-
:base(
154
-
rawData,
155
-
password)
131
+
:base(rawData)
156
132
{
157
133
_privateKey=key;
134
+
_password=password;
158
135
159
-
DecodePrivateKeyNative(key,password);
136
+
DecodePrivateKeyNative(
137
+
key,
138
+
password);
160
139
}
161
140
162
141
/// <summary>
163
-
/// Gets a value that indicates whether an X509Certificate2 object contains a private key.
142
+
/// Gets a value that indicates whether an <see cref="X509Certificate2"/> object contains a private key.
164
143
/// </summary>
165
144
/// <value><see langword="true"/> if the <see cref="X509Certificate2"/> object contains a private key; otherwise, <see langword="false"/>.</value>
166
145
publicboolHasPrivateKey
@@ -172,19 +151,19 @@ public bool HasPrivateKey
172
151
}
173
152
174
153
/// <summary>
175
-
/// Gets the private key, null if no private key
154
+
/// Gets the private key, null if there isn't a private key.
176
155
/// </summary>
177
156
/// <remarks>This will give you access directly to the raw decoded byte array of the private key</remarks>
178
157
publicbyte[]PrivateKey=>_privateKey;
179
158
180
159
/// <summary>
181
-
/// Gets the public key
160
+
/// Gets the public key.
182
161
/// </summary>
183
-
/// <remarks>This will give you access directly to the raw decoded byte array of the public key</remarks>
162
+
/// <remarks>This will give you access directly to the raw decoded byte array of the public key.</remarks>
184
163
publicbyte[]PublicKey=>RawData;
185
164
186
165
/// <summary>
187
-
/// Gets the date in local time after which a certificate is no longer valid.
166
+
/// Gets the date (in UTC time) after which a certificate is no longer valid.
188
167
/// </summary>
189
168
/// <value>A <see cref="DateTime"/> object that represents the expiration date for the certificate.</value>
190
169
publicDateTimeNotAfter
@@ -196,7 +175,7 @@ public DateTime NotAfter
196
175
}
197
176
198
177
/// <summary>
199
-
/// Gets the date in local time on which a certificate becomes valid.
178
+
/// Gets the date (in UTC time) on which a certificate becomes valid.
200
179
/// </summary>
201
180
/// <value>A <see cref="DateTime"/> object that represents the effective date of the certificate.</value>
0 commit comments