mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +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
|
@ -30,8 +30,6 @@ import java.security.AlgorithmParametersSpi;
|
|||
import java.security.spec.AlgorithmParameterSpec;
|
||||
import java.security.spec.InvalidParameterSpecException;
|
||||
import javax.crypto.spec.GCMParameterSpec;
|
||||
import sun.security.util.HexDumpEncoder;
|
||||
import sun.security.util.*;
|
||||
|
||||
/**
|
||||
* This class implements the parameter set used with
|
||||
|
@ -60,11 +58,10 @@ public final class GCMParameters extends AlgorithmParametersSpi {
|
|||
protected void engineInit(AlgorithmParameterSpec paramSpec)
|
||||
throws InvalidParameterSpecException {
|
||||
|
||||
if (!(paramSpec instanceof GCMParameterSpec)) {
|
||||
if (!(paramSpec instanceof GCMParameterSpec gps)) {
|
||||
throw new InvalidParameterSpecException
|
||||
("Inappropriate parameter specification");
|
||||
}
|
||||
GCMParameterSpec gps = (GCMParameterSpec) paramSpec;
|
||||
// need to convert from bits to bytes for ASN.1 encoding
|
||||
this.tLen = gps.getTLen()/8;
|
||||
if (this.tLen < 12 || this.tLen > 16 ) {
|
||||
|
@ -143,11 +140,9 @@ public final class GCMParameters extends AlgorithmParametersSpi {
|
|||
protected String engineToString() {
|
||||
String LINE_SEP = System.lineSeparator();
|
||||
HexDumpEncoder encoder = new HexDumpEncoder();
|
||||
StringBuilder sb
|
||||
= new StringBuilder(LINE_SEP + " iv:" + LINE_SEP + "["
|
||||
+ encoder.encodeBuffer(iv) + "]");
|
||||
|
||||
sb.append(LINE_SEP + "tLen(bits):" + LINE_SEP + tLen*8 + LINE_SEP);
|
||||
return sb.toString();
|
||||
return LINE_SEP + " iv:" + LINE_SEP + "["
|
||||
+ encoder.encodeBuffer(iv) + "]" + LINE_SEP + "tLen(bits):"
|
||||
+ LINE_SEP + tLen * 8 + LINE_SEP;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue