RFR: 8246797: A convenient method to read OPTIONAL element

Weijun Wang weijun at openjdk.java.net
Mon Aug 23 14:58:47 UTC 2021

This code change adds new methods to `DerInputStream` to easily and safely read optional fields in a ASN.1 DER-encoded value. It also adds several wrapping methods to `DerValue` to avoid unnecessary memory copying when calling by an internal method.

The new methods are applied to `OAEPParameters` to show out how they work. A new regression test is added to show that not only the new methods are simper but they are safer and more correct.


Commit messages:
 - 8246797: A convenient method to read OPTIONAL element

Changes: https://git.openjdk.java.net/jdk/pull/5221/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=5221&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8246797
  Stats: 250 lines in 4 files changed: 197 ins; 20 del; 33 mod
  Patch: https://git.openjdk.java.net/jdk/pull/5221.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/5221/head:pull/5221

PR: https://git.openjdk.java.net/jdk/pull/5221

More information about the security-dev mailing list