Merge
Reviewed-by: dfuchs
This commit is contained in:
commit
d2f9a1eb97
src
hotspot
cpu
share
java.base/share/classes/sun/security/rsa
java.net.http/share/classes/jdk/internal/net/http
jdk.crypto.mscapi/windows/classes/sun/security/mscapi
test/jdk/sun/security/pkcs11
@ -168,8 +168,10 @@ LIR_Address* LIRGenerator::generate_address(LIR_Opr base, LIR_Opr index,
|
||||
if (index->is_register()) {
|
||||
// apply the shift and accumulate the displacement
|
||||
if (shift > 0) {
|
||||
LIR_Opr tmp = new_pointer_register();
|
||||
__ shift_left(index, shift, tmp);
|
||||
// Use long register to avoid overflow when shifting large index values left.
|
||||
LIR_Opr tmp = new_register(T_LONG);
|
||||
__ convert(Bytecodes::_i2l, index, tmp);
|
||||
__ shift_left(tmp, shift, tmp);
|
||||
index = tmp;
|
||||
}
|
||||
if (large_disp != 0) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2023 SAP SE. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
@ -165,8 +165,10 @@ LIR_Address* LIRGenerator::generate_address(LIR_Opr base, LIR_Opr index,
|
||||
if (index->is_register()) {
|
||||
// Apply the shift and accumulate the displacement.
|
||||
if (shift > 0) {
|
||||
LIR_Opr tmp = new_pointer_register();
|
||||
__ shift_left(index, shift, tmp);
|
||||
// Use long register to avoid overflow when shifting large index values left.
|
||||
LIR_Opr tmp = new_register(T_LONG);
|
||||
__ convert(Bytecodes::_i2l, index, tmp);
|
||||
__ shift_left(tmp, shift, tmp);
|
||||
index = tmp;
|
||||
}
|
||||
if (large_disp != 0) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2017 SAP SE. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
@ -157,8 +157,10 @@ LIR_Address* LIRGenerator::generate_address(LIR_Opr base, LIR_Opr index,
|
||||
return new LIR_Address(base, index, type);
|
||||
} else {
|
||||
if (shift > 0) {
|
||||
LIR_Opr tmp = new_pointer_register();
|
||||
__ shift_left(index, shift, tmp);
|
||||
// Use long register to avoid overflow when shifting large index values left.
|
||||
LIR_Opr tmp = new_register(T_LONG);
|
||||
__ convert(Bytecodes::_i2l, index, tmp);
|
||||
__ shift_left(tmp, shift, tmp);
|
||||
index = tmp;
|
||||
}
|
||||
return new LIR_Address(base, index, disp, type);
|
||||
|
@ -2081,18 +2081,17 @@ oop java_lang_Throwable::message(oop throwable) {
|
||||
return throwable->obj_field(_detailMessage_offset);
|
||||
}
|
||||
|
||||
oop java_lang_Throwable::cause(oop throwable) {
|
||||
return throwable->obj_field(_cause_offset);
|
||||
const char* java_lang_Throwable::message_as_utf8(oop throwable) {
|
||||
oop msg = java_lang_Throwable::message(throwable);
|
||||
const char* msg_utf8 = nullptr;
|
||||
if (msg != nullptr) {
|
||||
msg_utf8 = java_lang_String::as_utf8_string(msg);
|
||||
}
|
||||
return msg_utf8;
|
||||
}
|
||||
|
||||
// Return Symbol for detailed_message or null
|
||||
Symbol* java_lang_Throwable::detail_message(oop throwable) {
|
||||
PreserveExceptionMark pm(Thread::current());
|
||||
oop detailed_message = java_lang_Throwable::message(throwable);
|
||||
if (detailed_message != nullptr) {
|
||||
return java_lang_String::as_symbol(detailed_message);
|
||||
}
|
||||
return nullptr;
|
||||
oop java_lang_Throwable::cause(oop throwable) {
|
||||
return throwable->obj_field(_cause_offset);
|
||||
}
|
||||
|
||||
void java_lang_Throwable::set_message(oop throwable, oop value) {
|
||||
|
@ -598,12 +598,14 @@ class java_lang_Throwable: AllStatic {
|
||||
static void set_backtrace(oop throwable, oop value);
|
||||
static int depth(oop throwable);
|
||||
static void set_depth(oop throwable, int value);
|
||||
static int get_detailMessage_offset() { CHECK_INIT(_detailMessage_offset); }
|
||||
// Message
|
||||
static int get_detailMessage_offset() { CHECK_INIT(_detailMessage_offset); }
|
||||
static oop message(oop throwable);
|
||||
static oop cause(oop throwable);
|
||||
static const char* message_as_utf8(oop throwable);
|
||||
static void set_message(oop throwable, oop value);
|
||||
static Symbol* detail_message(oop throwable);
|
||||
|
||||
static oop cause(oop throwable);
|
||||
|
||||
static void print_stack_element(outputStream *st, Method* method, int bci);
|
||||
|
||||
static void compute_offsets();
|
||||
|
@ -66,8 +66,8 @@ void ResolutionErrorTable::initialize() {
|
||||
|
||||
// create new error entry
|
||||
void ResolutionErrorTable::add_entry(const constantPoolHandle& pool, int cp_index,
|
||||
Symbol* error, Symbol* message,
|
||||
Symbol* cause, Symbol* cause_msg)
|
||||
Symbol* error, const char* message,
|
||||
Symbol* cause, const char* cause_msg)
|
||||
{
|
||||
assert_locked_or_safepoint(SystemDictionary_lock);
|
||||
assert(!pool.is_null() && error != nullptr, "adding null obj");
|
||||
@ -97,26 +97,30 @@ ResolutionErrorEntry* ResolutionErrorTable::find_entry(const constantPoolHandle&
|
||||
return entry == nullptr ? nullptr : *entry;
|
||||
}
|
||||
|
||||
ResolutionErrorEntry::ResolutionErrorEntry(Symbol* error, Symbol* message,
|
||||
Symbol* cause, Symbol* cause_msg):
|
||||
ResolutionErrorEntry::ResolutionErrorEntry(Symbol* error, const char* message,
|
||||
Symbol* cause, const char* cause_msg):
|
||||
_error(error),
|
||||
_message(message),
|
||||
_message(message != nullptr ? os::strdup(message) : nullptr),
|
||||
_cause(cause),
|
||||
_cause_msg(cause_msg),
|
||||
_cause_msg(cause_msg != nullptr ? os::strdup(cause_msg) : nullptr),
|
||||
_nest_host_error(nullptr) {
|
||||
|
||||
Symbol::maybe_increment_refcount(_error);
|
||||
Symbol::maybe_increment_refcount(_message);
|
||||
Symbol::maybe_increment_refcount(_cause);
|
||||
Symbol::maybe_increment_refcount(_cause_msg);
|
||||
}
|
||||
|
||||
ResolutionErrorEntry::~ResolutionErrorEntry() {
|
||||
// decrement error refcount
|
||||
Symbol::maybe_decrement_refcount(_error);
|
||||
Symbol::maybe_decrement_refcount(_message);
|
||||
Symbol::maybe_decrement_refcount(_cause);
|
||||
Symbol::maybe_decrement_refcount(_cause_msg);
|
||||
|
||||
if (_message != nullptr) {
|
||||
FREE_C_HEAP_ARRAY(char, _message);
|
||||
}
|
||||
|
||||
if (_cause_msg != nullptr) {
|
||||
FREE_C_HEAP_ARRAY(char, _cause_msg);
|
||||
}
|
||||
|
||||
if (nest_host_error() != nullptr) {
|
||||
FREE_C_HEAP_ARRAY(char, nest_host_error());
|
||||
|
@ -36,10 +36,11 @@ class ResolutionErrorTable : AllStatic {
|
||||
|
||||
public:
|
||||
static void initialize();
|
||||
static void add_entry(const constantPoolHandle& pool, int which, Symbol* error, Symbol* message,
|
||||
Symbol* cause, Symbol* cause_msg);
|
||||
static void add_entry(const constantPoolHandle& pool, int cp_index,
|
||||
Symbol* error, const char* error_msg,
|
||||
Symbol* cause, const char* cause_msg);
|
||||
|
||||
static void add_entry(const constantPoolHandle& pool, int which, const char* message);
|
||||
static void add_entry(const constantPoolHandle& pool, int cp_index, const char* message);
|
||||
|
||||
// find error given the constant pool and constant pool index
|
||||
static ResolutionErrorEntry* find_entry(const constantPoolHandle& pool, int cp_index);
|
||||
@ -68,34 +69,38 @@ public:
|
||||
class ResolutionErrorEntry : public CHeapObj<mtClass> {
|
||||
private:
|
||||
Symbol* _error;
|
||||
Symbol* _message;
|
||||
const char* _message;
|
||||
Symbol* _cause;
|
||||
Symbol* _cause_msg;
|
||||
const char* _cause_msg;
|
||||
const char* _nest_host_error;
|
||||
|
||||
NONCOPYABLE(ResolutionErrorEntry);
|
||||
|
||||
public:
|
||||
ResolutionErrorEntry(Symbol* error, Symbol* message, Symbol* cause, Symbol* cause_msg);
|
||||
// The incoming message and cause_msg are copied to the C-Heap.
|
||||
ResolutionErrorEntry(Symbol* error, const char* message,
|
||||
Symbol* cause, const char* cause_msg);
|
||||
|
||||
ResolutionErrorEntry(const char* message):
|
||||
// The incoming nest host error message is already in the C-Heap.
|
||||
ResolutionErrorEntry(const char* message):
|
||||
_error(nullptr),
|
||||
_message(nullptr),
|
||||
_cause(nullptr),
|
||||
_cause_msg(nullptr),
|
||||
_nest_host_error(message) {}
|
||||
|
||||
~ResolutionErrorEntry();
|
||||
~ResolutionErrorEntry();
|
||||
|
||||
void set_nest_host_error(const char* message) {
|
||||
_nest_host_error = message;
|
||||
}
|
||||
// The incoming nest host error message is already in the C-Heap.
|
||||
void set_nest_host_error(const char* message) {
|
||||
_nest_host_error = message;
|
||||
}
|
||||
|
||||
|
||||
Symbol* error() const { return _error; }
|
||||
Symbol* message() const { return _message; }
|
||||
const char* message() const { return _message; }
|
||||
Symbol* cause() const { return _cause; }
|
||||
Symbol* cause_msg() const { return _cause_msg; }
|
||||
const char* cause_msg() const { return _cause_msg; }
|
||||
const char* nest_host_error() const { return _nest_host_error; }
|
||||
};
|
||||
|
||||
|
@ -1799,8 +1799,8 @@ bool SystemDictionary::add_loader_constraint(Symbol* class_name,
|
||||
// Add entry to resolution error table to record the error when the first
|
||||
// attempt to resolve a reference to a class has failed.
|
||||
void SystemDictionary::add_resolution_error(const constantPoolHandle& pool, int which,
|
||||
Symbol* error, Symbol* message,
|
||||
Symbol* cause, Symbol* cause_msg) {
|
||||
Symbol* error, const char* message,
|
||||
Symbol* cause, const char* cause_msg) {
|
||||
{
|
||||
MutexLocker ml(Thread::current(), SystemDictionary_lock);
|
||||
ResolutionErrorEntry* entry = ResolutionErrorTable::find_entry(pool, which);
|
||||
@ -1817,7 +1817,8 @@ void SystemDictionary::delete_resolution_error(ConstantPool* pool) {
|
||||
|
||||
// Lookup resolution error table. Returns error if found, otherwise null.
|
||||
Symbol* SystemDictionary::find_resolution_error(const constantPoolHandle& pool, int which,
|
||||
Symbol** message, Symbol** cause, Symbol** cause_msg) {
|
||||
const char** message,
|
||||
Symbol** cause, const char** cause_msg) {
|
||||
|
||||
{
|
||||
MutexLocker ml(Thread::current(), SystemDictionary_lock);
|
||||
|
@ -272,12 +272,13 @@ public:
|
||||
|
||||
// Record the error when the first attempt to resolve a reference from a constant
|
||||
// pool entry to a class fails.
|
||||
static void add_resolution_error(const constantPoolHandle& pool, int which, Symbol* error,
|
||||
Symbol* message, Symbol* cause = nullptr, Symbol* cause_msg = nullptr);
|
||||
static void add_resolution_error(const constantPoolHandle& pool, int which,
|
||||
Symbol* error, const char* message,
|
||||
Symbol* cause = nullptr, const char* cause_msg = nullptr);
|
||||
static void delete_resolution_error(ConstantPool* pool);
|
||||
static Symbol* find_resolution_error(const constantPoolHandle& pool, int which,
|
||||
Symbol** message, Symbol** cause, Symbol** cause_msg);
|
||||
|
||||
const char** message,
|
||||
Symbol** cause, const char** cause_msg);
|
||||
|
||||
// Record a nest host resolution/validation error
|
||||
static void add_nest_host_error(const constantPoolHandle& pool, int which,
|
||||
|
@ -802,13 +802,16 @@ void ConstantPool::resolve_string_constants_impl(const constantPoolHandle& this_
|
||||
}
|
||||
}
|
||||
|
||||
static Symbol* exception_message(const constantPoolHandle& this_cp, int which, constantTag tag, oop pending_exception) {
|
||||
static const char* exception_message(const constantPoolHandle& this_cp, int which, constantTag tag, oop pending_exception) {
|
||||
// Note: caller needs ResourceMark
|
||||
|
||||
// Dig out the detailed message to reuse if possible
|
||||
Symbol* message = java_lang_Throwable::detail_message(pending_exception);
|
||||
if (message != nullptr) {
|
||||
return message;
|
||||
const char* msg = java_lang_Throwable::message_as_utf8(pending_exception);
|
||||
if (msg != nullptr) {
|
||||
return msg;
|
||||
}
|
||||
|
||||
Symbol* message = nullptr;
|
||||
// Return specific message for the tag
|
||||
switch (tag.value()) {
|
||||
case JVM_CONSTANT_UnresolvedClass:
|
||||
@ -831,49 +834,48 @@ static Symbol* exception_message(const constantPoolHandle& this_cp, int which, c
|
||||
ShouldNotReachHere();
|
||||
}
|
||||
|
||||
return message;
|
||||
return message != nullptr ? message->as_C_string() : nullptr;
|
||||
}
|
||||
|
||||
static void add_resolution_error(const constantPoolHandle& this_cp, int which,
|
||||
static void add_resolution_error(JavaThread* current, const constantPoolHandle& this_cp, int which,
|
||||
constantTag tag, oop pending_exception) {
|
||||
|
||||
ResourceMark rm(current);
|
||||
Symbol* error = pending_exception->klass()->name();
|
||||
oop cause = java_lang_Throwable::cause(pending_exception);
|
||||
|
||||
// Also dig out the exception cause, if present.
|
||||
Symbol* cause_sym = nullptr;
|
||||
Symbol* cause_msg = nullptr;
|
||||
const char* cause_msg = nullptr;
|
||||
if (cause != nullptr && cause != pending_exception) {
|
||||
cause_sym = cause->klass()->name();
|
||||
cause_msg = java_lang_Throwable::detail_message(cause);
|
||||
cause_msg = java_lang_Throwable::message_as_utf8(cause);
|
||||
}
|
||||
|
||||
Symbol* message = exception_message(this_cp, which, tag, pending_exception);
|
||||
const char* message = exception_message(this_cp, which, tag, pending_exception);
|
||||
SystemDictionary::add_resolution_error(this_cp, which, error, message, cause_sym, cause_msg);
|
||||
}
|
||||
|
||||
|
||||
void ConstantPool::throw_resolution_error(const constantPoolHandle& this_cp, int which, TRAPS) {
|
||||
ResourceMark rm(THREAD);
|
||||
Symbol* message = nullptr;
|
||||
const char* message = nullptr;
|
||||
Symbol* cause = nullptr;
|
||||
Symbol* cause_msg = nullptr;
|
||||
const char* cause_msg = nullptr;
|
||||
Symbol* error = SystemDictionary::find_resolution_error(this_cp, which, &message, &cause, &cause_msg);
|
||||
assert(error != nullptr, "checking");
|
||||
const char* cause_str = cause_msg != nullptr ? cause_msg->as_C_string() : nullptr;
|
||||
|
||||
CLEAR_PENDING_EXCEPTION;
|
||||
if (message != nullptr) {
|
||||
char* msg = message->as_C_string();
|
||||
if (cause != nullptr) {
|
||||
Handle h_cause = Exceptions::new_exception(THREAD, cause, cause_str);
|
||||
THROW_MSG_CAUSE(error, msg, h_cause);
|
||||
Handle h_cause = Exceptions::new_exception(THREAD, cause, cause_msg);
|
||||
THROW_MSG_CAUSE(error, message, h_cause);
|
||||
} else {
|
||||
THROW_MSG(error, msg);
|
||||
THROW_MSG(error, message);
|
||||
}
|
||||
} else {
|
||||
if (cause != nullptr) {
|
||||
Handle h_cause = Exceptions::new_exception(THREAD, cause, cause_str);
|
||||
Handle h_cause = Exceptions::new_exception(THREAD, cause, cause_msg);
|
||||
THROW_CAUSE(error, h_cause);
|
||||
} else {
|
||||
THROW(error);
|
||||
@ -895,7 +897,7 @@ void ConstantPool::save_and_throw_exception(const constantPoolHandle& this_cp, i
|
||||
// and OutOfMemoryError, etc, or if the thread was hit by stop()
|
||||
// Needs clarification to section 5.4.3 of the VM spec (see 6308271)
|
||||
} else if (this_cp->tag_at(cp_index).value() != error_tag) {
|
||||
add_resolution_error(this_cp, cp_index, tag, PENDING_EXCEPTION);
|
||||
add_resolution_error(THREAD, this_cp, cp_index, tag, PENDING_EXCEPTION);
|
||||
// CAS in the tag. If a thread beat us to registering this error that's fine.
|
||||
// If another thread resolved the reference, this is a race condition. This
|
||||
// thread may have had a security manager or something temporary.
|
||||
|
@ -566,9 +566,9 @@ bool ConstantPoolCache::save_and_throw_indy_exc(
|
||||
CLEAR_PENDING_EXCEPTION;
|
||||
return false;
|
||||
}
|
||||
|
||||
ResourceMark rm(THREAD);
|
||||
Symbol* error = PENDING_EXCEPTION->klass()->name();
|
||||
Symbol* message = java_lang_Throwable::detail_message(PENDING_EXCEPTION);
|
||||
const char* message = java_lang_Throwable::message_as_utf8(PENDING_EXCEPTION);
|
||||
|
||||
int encoded_index = ResolutionErrorTable::encode_indy_index(
|
||||
ConstantPool::encode_invokedynamic_index(index));
|
||||
|
@ -566,11 +566,11 @@ void Exceptions::debug_check_abort_helper(Handle exception, const char* message)
|
||||
// for logging exceptions
|
||||
void Exceptions::log_exception(Handle exception, const char* message) {
|
||||
ResourceMark rm;
|
||||
Symbol* detail_message = java_lang_Throwable::detail_message(exception());
|
||||
const char* detail_message = java_lang_Throwable::message_as_utf8(exception());
|
||||
if (detail_message != nullptr) {
|
||||
log_info(exceptions)("Exception <%s: %s>\n thrown in %s",
|
||||
exception->print_value_string(),
|
||||
detail_message->as_C_string(),
|
||||
detail_message,
|
||||
message);
|
||||
} else {
|
||||
log_info(exceptions)("Exception <%s>\n thrown in %s",
|
||||
|
@ -301,14 +301,6 @@ public final class RSAPrivateCrtKeyImpl
|
||||
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.
|
||||
|
@ -138,14 +138,6 @@ public final class RSAPrivateKeyImpl extends PKCS8Key implements RSAPrivateKey {
|
||||
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>
|
||||
|
@ -108,14 +108,10 @@ final class ConnectionPool {
|
||||
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;
|
||||
|
@ -76,10 +76,14 @@ abstract class CKey implements Key, Length {
|
||||
|
||||
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.
|
||||
@ -102,6 +106,18 @@ abstract class CKey implements Key, Length {
|
||||
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);
|
||||
|
@ -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
|
||||
@ -65,16 +65,6 @@ class CPrivateKey extends CKey implements PrivateKey {
|
||||
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)
|
||||
|
@ -114,9 +114,8 @@ public abstract class CPublicKey extends CKey implements PublicKey {
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
@ -135,16 +134,8 @@ public abstract class CPublicKey extends CKey implements PublicKey {
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
@ -215,7 +206,7 @@ public abstract class CPublicKey extends CKey implements PublicKey {
|
||||
|
||||
protected CPublicKey(
|
||||
String alg, NativeHandles handles, int keyLength) {
|
||||
super(alg, handles, keyLength);
|
||||
super(alg, handles, keyLength, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -233,7 +233,17 @@ public abstract class PKCS11Test {
|
||||
throw new RuntimeException("Test root directory not found");
|
||||
}
|
||||
}
|
||||
PKCS11_BASE = new File(cwd, PKCS11_REL_PATH.replace('/', SEP)).getAbsolutePath();
|
||||
File pkcs11 = new File(cwd, PKCS11_REL_PATH.replace('/', SEP));
|
||||
if (!new File(pkcs11, "nss/p11-nss.txt").exists()) {
|
||||
// this test might be in the closed
|
||||
pkcs11 = new File(new File(cwd, "../../../open/test/jdk"),
|
||||
PKCS11_REL_PATH.replace('/', SEP));
|
||||
if (!new File(pkcs11, "nss/p11-nss.txt").exists()) {
|
||||
throw new RuntimeException("Not a PKCS11 directory"
|
||||
+ pkcs11.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
PKCS11_BASE = pkcs11.getAbsolutePath();
|
||||
return PKCS11_BASE;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user