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
The following Java class encodes the certificate from `X-ARR-ClientCert` to an `X509Certificate` instance. `certificateIsValid()` validates that the certificate's thumbprint matches the one given in the constructor and that certificate has not expired.
216
+
217
+
java
218
+
```
219
+
import java.io.ByteArrayInputStream;
220
+
import java.security.NoSuchAlgorithmException;
221
+
import java.security.cert.*;
222
+
import java.security.MessageDigest;
223
+
224
+
import sun.security.provider.X509Factory;
225
+
226
+
import javax.xml.bind.DatatypeConverter;
227
+
import java.util.Base64;
228
+
import java.util.Date;
229
+
230
+
public class ClientCertValidator {
231
+
232
+
private String thumbprint;
233
+
private X509Certificate certificate;
234
+
235
+
/**
236
+
* Constructor.
237
+
* @param certificate The certificate from the "X-ARR-ClientCert" HTTP header
238
+
* @param thumbprint The thumbprint to check against
239
+
* @throws CertificateException If the certificate factory cannot be created.
240
+
*/
241
+
public ClientCertValidator(String certificate, String thumbprint) throws CertificateException {
0 commit comments