equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
30 import java.security.InvalidKeyException; |
30 import java.security.InvalidKeyException; |
31 import java.security.SignatureException; |
31 import java.security.SignatureException; |
32 import java.security.Principal; |
32 import java.security.Principal; |
33 import java.security.Provider; |
33 import java.security.Provider; |
34 import java.security.PublicKey; |
34 import java.security.PublicKey; |
|
35 import java.security.Signature; |
35 import javax.security.auth.x500.X500Principal; |
36 import javax.security.auth.x500.X500Principal; |
36 |
37 |
37 import java.math.BigInteger; |
38 import java.math.BigInteger; |
38 import java.util.Date; |
39 import java.util.Date; |
39 import java.util.Set; |
40 import java.util.Set; |
239 * @since 1.8 |
240 * @since 1.8 |
240 */ |
241 */ |
241 public void verify(PublicKey key, Provider sigProvider) |
242 public void verify(PublicKey key, Provider sigProvider) |
242 throws CRLException, NoSuchAlgorithmException, |
243 throws CRLException, NoSuchAlgorithmException, |
243 InvalidKeyException, SignatureException { |
244 InvalidKeyException, SignatureException { |
244 X509CRLImpl.verify(this, key, sigProvider); |
245 Signature sig = (sigProvider == null) |
|
246 ? Signature.getInstance(getSigAlgName()) |
|
247 : Signature.getInstance(getSigAlgName(), sigProvider); |
|
248 sig.initVerify(key); |
|
249 |
|
250 byte[] tbsCRL = getTBSCertList(); |
|
251 sig.update(tbsCRL, 0, tbsCRL.length); |
|
252 |
|
253 if (sig.verify(getSignature()) == false) { |
|
254 throw new SignatureException("Signature does not match."); |
|
255 } |
245 } |
256 } |
246 |
257 |
247 /** |
258 /** |
248 * Gets the {@code version} (version number) value from the CRL. |
259 * Gets the {@code version} (version number) value from the CRL. |
249 * The ASN.1 definition for this is: |
260 * The ASN.1 definition for this is: |