mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 23:34:52 +02:00
8291509: Minor cleanup could be done in sun.security
Reviewed-by: weijun
This commit is contained in:
parent
6beeb8471c
commit
4cec141a90
298 changed files with 2650 additions and 3262 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -35,7 +35,7 @@ import sun.security.util.*;
|
|||
*
|
||||
* <p>Extensions are additional attributes which can be inserted in a X509
|
||||
* v3 certificate. For example a "Driving License Certificate" could have
|
||||
* the driving license number as a extension.
|
||||
* the driving license number as an extension.
|
||||
*
|
||||
* <p>Extensions are represented as a sequence of the extension identifier
|
||||
* (Object Identifier), a boolean flag stating whether the extension is to
|
||||
|
@ -65,7 +65,7 @@ public class Extension implements java.security.cert.Extension {
|
|||
protected byte[] extensionValue = null;
|
||||
|
||||
/**
|
||||
* Default constructor. Used only by sub-classes.
|
||||
* Default constructor. Used only by subclasses.
|
||||
*/
|
||||
public Extension() { }
|
||||
|
||||
|
@ -86,11 +86,10 @@ public class Extension implements java.security.cert.Extension {
|
|||
|
||||
// Extension value (DER encoded)
|
||||
val = in.getDerValue();
|
||||
extensionValue = val.getOctetString();
|
||||
} else {
|
||||
critical = false;
|
||||
extensionValue = val.getOctetString();
|
||||
}
|
||||
extensionValue = val.getOctetString();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -151,7 +150,7 @@ public class Extension implements java.security.cert.Extension {
|
|||
|
||||
dos1.putOID(extensionId);
|
||||
if (critical) {
|
||||
dos1.putBoolean(critical);
|
||||
dos1.putBoolean(true);
|
||||
}
|
||||
dos1.putOctetString(extensionValue);
|
||||
|
||||
|
@ -176,7 +175,7 @@ public class Extension implements java.security.cert.Extension {
|
|||
|
||||
dos.putOID(extensionId);
|
||||
if (critical)
|
||||
dos.putBoolean(critical);
|
||||
dos.putBoolean(true);
|
||||
dos.putOctetString(extensionValue);
|
||||
|
||||
out.write(DerValue.tag_Sequence, dos);
|
||||
|
@ -201,7 +200,7 @@ public class Extension implements java.security.cert.Extension {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the extension value as an byte array for further processing.
|
||||
* Returns the extension value as a byte array for further processing.
|
||||
* Note, this is the raw DER value of the extension, not the DER
|
||||
* encoded octet string which is in the certificate.
|
||||
* This method does not return a clone; it is the responsibility of the
|
||||
|
@ -259,9 +258,8 @@ public class Extension implements java.security.cert.Extension {
|
|||
public boolean equals(Object other) {
|
||||
if (this == other)
|
||||
return true;
|
||||
if (!(other instanceof Extension))
|
||||
if (!(other instanceof Extension otherExt))
|
||||
return false;
|
||||
Extension otherExt = (Extension) other;
|
||||
if (critical != otherExt.critical)
|
||||
return false;
|
||||
if (!extensionId.equals(otherExt.extensionId))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue