|
1 | 1 | /* |
2 | | - * Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved. |
| 2 | + * Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved. |
3 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 | 4 | * |
5 | 5 | * This code is free software; you can redistribute it and/or modify it |
|
53 | 53 | */ |
54 | 54 | public class PKCS7 { |
55 | 55 |
|
56 | | - private ObjectIdentifier contentType; |
57 | | - |
58 | 56 | // the ASN.1 members for a signedData (and other) contentTypes |
59 | 57 | private BigInteger version = null; |
60 | 58 | private AlgorithmId[] digestAlgorithmIds = null; |
@@ -167,7 +165,7 @@ private void parse(DerInputStream derin, boolean oldStyle) |
167 | 165 | throws IOException |
168 | 166 | { |
169 | 167 | ContentInfo block = new ContentInfo(derin, oldStyle); |
170 | | - contentType = block.contentType; |
| 168 | + ObjectIdentifier contentType = block.contentType; |
171 | 169 | DerValue content = block.getContent(); |
172 | 170 |
|
173 | 171 | if (contentType.equals(ContentInfo.SIGNED_DATA_OID)) { |
@@ -240,14 +238,10 @@ private void parseNetscapeCertChain(DerValue val) |
240 | 238 | bais.close(); |
241 | 239 | bais = null; |
242 | 240 | } |
243 | | - } catch (CertificateException ce) { |
| 241 | + } catch (CertificateException | IOException ce) { |
244 | 242 | ParsingException pe = new ParsingException(ce.getMessage()); |
245 | 243 | pe.initCause(ce); |
246 | 244 | throw pe; |
247 | | - } catch (IOException ioe) { |
248 | | - ParsingException pe = new ParsingException(ioe.getMessage()); |
249 | | - pe.initCause(ioe); |
250 | | - throw pe; |
251 | 245 | } finally { |
252 | 246 | if (bais != null) |
253 | 247 | bais.close(); |
@@ -330,14 +324,10 @@ private void parseSignedData(DerValue val) |
330 | 324 | } |
331 | 325 | count++; |
332 | 326 | } |
333 | | - } catch (CertificateException ce) { |
| 327 | + } catch (CertificateException | IOException ce) { |
334 | 328 | ParsingException pe = new ParsingException(ce.getMessage()); |
335 | 329 | pe.initCause(ce); |
336 | 330 | throw pe; |
337 | | - } catch (IOException ioe) { |
338 | | - ParsingException pe = new ParsingException(ioe.getMessage()); |
339 | | - pe.initCause(ioe); |
340 | | - throw pe; |
341 | 331 | } finally { |
342 | 332 | if (bais != null) |
343 | 333 | bais.close(); |
@@ -444,14 +434,10 @@ private void parseOldSignedData(DerValue val) |
444 | 434 | bais.close(); |
445 | 435 | bais = null; |
446 | 436 | } |
447 | | - } catch (CertificateException ce) { |
| 437 | + } catch (CertificateException | IOException ce) { |
448 | 438 | ParsingException pe = new ParsingException(ce.getMessage()); |
449 | 439 | pe.initCause(ce); |
450 | 440 | throw pe; |
451 | | - } catch (IOException ioe) { |
452 | | - ParsingException pe = new ParsingException(ioe.getMessage()); |
453 | | - pe.initCause(ioe); |
454 | | - throw pe; |
455 | 441 | } finally { |
456 | 442 | if (bais != null) |
457 | 443 | bais.close(); |
|
0 commit comments