Skip to content

Commit

Permalink
Merge jdk-21.0.3+9 into v0.44.0-release
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Shipton <Peter_Shipton@ca.ibm.com>
  • Loading branch information
pshipton committed Apr 17, 2024
2 parents 5b5adb3 + e11d51e commit 8f88fed
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 52 deletions.
4 changes: 2 additions & 2 deletions make/conf/version-numbers.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 2024, 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
Expand Down Expand Up @@ -39,4 +39,4 @@ DEFAULT_VERSION_CLASSFILE_MINOR=0
DEFAULT_VERSION_DOCS_API_SINCE=11
DEFAULT_ACCEPTABLE_BOOT_VERSIONS="20 21"
DEFAULT_JDK_SOURCE_TARGET_VERSION=21
DEFAULT_PROMOTED_VERSION_PRE=ea
DEFAULT_PROMOTED_VERSION_PRE=
Original file line number Diff line number Diff line change
Expand Up @@ -364,14 +364,6 @@ public AlgorithmParameterSpec getParams() {
return keyParams;
}

// return a string representation of this key for debugging
@Override
public String toString() {
return "SunRsaSign " + type.keyAlgo + " private CRT key, "
+ n.bitLength() + " bits" + "\n params: " + keyParams
+ "\n modulus: " + n + "\n private exponent: " + d;
}

// utility method for parsing DER encoding of RSA private keys in PKCS#1
// format as defined in RFC 8017 Appendix A.1.2, i.e. SEQ of version, n,
// e, d, p, q, pe, qe, and coeff, and return the parsed components.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,6 @@ public AlgorithmParameterSpec getParams() {
return keyParams;
}

// return a string representation of this key for debugging
@Override
public String toString() {
return "Sun " + type.keyAlgo + " private key, " + n.bitLength()
+ " bits" + "\n params: " + keyParams + "\n modulus: " + n
+ "\n private exponent: " + d;
}

/**
* Restores the state of this object from the stream.
* <p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,10 @@ public boolean equals(Object obj) {
return false;
}
if (secure && destination != null) {
if (destination.getHostName() != null) {
if (!destination.getHostName().equalsIgnoreCase(
other.destination.getHostName())) {
return false;
}
} else {
if (other.destination.getHostName() != null)
return false;
String hostString = destination.getHostString();
if (hostString == null || !hostString.equalsIgnoreCase(
other.destination.getHostString())) {
return false;
}
}
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,14 @@ protected void finalize() throws Throwable {

protected final String algorithm;

protected CKey(String algorithm, NativeHandles handles, int keyLength) {
private final boolean isPublic;

protected CKey(String algorithm, NativeHandles handles, int keyLength,
boolean isPublic) {
this.algorithm = algorithm;
this.handles = handles;
this.keyLength = keyLength;
this.isPublic = isPublic;
}

// Native method to cleanup the key handle.
Expand All @@ -102,6 +106,18 @@ public String getAlgorithm() {
return algorithm;
}

public String toString() {
String typeStr;
if (handles.hCryptKey != 0) {
typeStr = getKeyType(handles.hCryptKey) + ", container=" +
getContainerName(handles.hCryptProv);
} else {
typeStr = "CNG";
}
return algorithm + " " + (isPublic ? "PublicKey" : "PrivateKey") +
" [size=" + keyLength + " bits, type=" + typeStr + "]";
}

protected static native String getContainerName(long hCryptProv);

protected static native String getKeyType(long hCryptKey);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class CPrivateKey extends CKey implements PrivateKey {
private static final long serialVersionUID = 8113152807912338063L;

private CPrivateKey(String alg, NativeHandles handles, int keyLength) {
super(alg, handles, keyLength);
super(alg, handles, keyLength, false);
}

// Called by native code inside security.cpp
Expand All @@ -65,16 +65,6 @@ public byte[] getEncoded() {
return null;
}

public String toString() {
if (handles.hCryptKey != 0) {
return algorithm + "PrivateKey [size=" + keyLength + " bits, type=" +
getKeyType(handles.hCryptKey) + ", container=" +
getContainerName(handles.hCryptProv) + "]";
} else {
return algorithm + "PrivateKey [size=" + keyLength + " bits, type=CNG]";
}
}

// This class is not serializable
@java.io.Serial
private void writeObject(java.io.ObjectOutputStream out)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,8 @@ public ECParameterSpec getParams() {
}

public String toString() {
StringBuffer sb = new StringBuffer();
sb.append(algorithm).append("PublicKey [size=").append(keyLength)
.append("]\n ECPoint: ").append(getW())
StringBuffer sb = new StringBuffer(super.toString());
sb.append("\n ECPoint: ").append(getW())
.append("\n params: ").append(getParams());
return sb.toString();
}
Expand All @@ -135,16 +134,8 @@ public static class CRSAPublicKey extends CPublicKey implements RSAPublicKey {
}

public String toString() {
StringBuffer sb = new StringBuffer();
sb.append(algorithm).append("PublicKey [size=").append(keyLength)
.append(" bits, type=");
if (handles.hCryptKey != 0) {
sb.append(getKeyType(handles.hCryptKey))
.append(", container=").append(getContainerName(handles.hCryptProv));
} else {
sb.append("CNG");
}
sb.append("]\n modulus: ").append(getModulus())
StringBuffer sb = new StringBuffer(super.toString());
sb.append("\n modulus: ").append(getModulus())
.append("\n public exponent: ").append(getPublicExponent());
return sb.toString();
}
Expand Down Expand Up @@ -215,7 +206,7 @@ public static CPublicKey of(

protected CPublicKey(
String alg, NativeHandles handles, int keyLength) {
super(alg, handles, keyLength);
super(alg, handles, keyLength, true);
}

@Override
Expand Down

0 comments on commit 8f88fed

Please sign in to comment.