Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TKSS-627: Add aliases for trust manager and key manager #628

Merged
merged 1 commit into from
Jan 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,13 @@ private static void putEntries(Provider provider) {
"com.tencent.kona.sun.security.ssl.KeyManagerFactoryImpl$SunX509");
provider.put("KeyManagerFactory.NewSunX509",
"com.tencent.kona.sun.security.ssl.KeyManagerFactoryImpl$X509");
provider.put("Alg.Alias.KeyManagerFactory.PKIX", "NewSunX509");

provider.put("TrustManagerFactory.SunX509",
"com.tencent.kona.sun.security.ssl.TrustManagerFactoryImpl$SimpleFactory");
provider.put("TrustManagerFactory.PKIX",
"com.tencent.kona.sun.security.ssl.TrustManagerFactoryImpl$PKIXFactory");
provider.put("Alg.Alias.TrustManagerFactory.SunPKIX", "PKIX");
provider.put("Alg.Alias.TrustManagerFactory.TencentPKIX", "PKIX");
provider.put("Alg.Alias.TrustManagerFactory.X509", "PKIX");
provider.put("Alg.Alias.TrustManagerFactory.X.509", "PKIX");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

import com.tencent.kona.sun.security.ssl.Authenticator.SSLAuthenticator;
import com.tencent.kona.sun.security.ssl.Authenticator.MAC;
import com.tencent.kona.sun.security.ssl.CipherSuite.MacAlg;

final class TLCPAuthenticator {

Expand Down Expand Up @@ -76,14 +77,14 @@ static final class TLCP11Mac extends TLCP11Authenticator implements MAC {
private final MacImpl macImpl;

TLCP11Mac(ProtocolVersion protocolVersion,
CipherSuite.MacAlg macAlg, SecretKey key) throws NoSuchAlgorithmException,
MacAlg macAlg, SecretKey key) throws NoSuchAlgorithmException,
InvalidKeyException {
super(protocolVersion);
this.macImpl = new MacImpl(protocolVersion, macAlg, key);
}

@Override
public CipherSuite.MacAlg macAlg() {
public MacAlg macAlg() {
return macImpl.macAlg;
}

Expand All @@ -93,19 +94,4 @@ public byte[] compute(byte type, ByteBuffer bb,
return macImpl.compute(type, bb, sequence, isSimulated);
}
}

static final long toLong(byte[] recordEnS) {
if (recordEnS != null && recordEnS.length == 8) {
return ((recordEnS[0] & 0xFFL) << 56) |
((recordEnS[1] & 0xFFL) << 48) |
((recordEnS[2] & 0xFFL) << 40) |
((recordEnS[3] & 0xFFL) << 32) |
((recordEnS[4] & 0xFFL) << 24) |
((recordEnS[5] & 0xFFL) << 16) |
((recordEnS[6] & 0xFFL) << 8) |
(recordEnS[7] & 0xFFL);
}

return -1L;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public static final class TLCP11Context
});

serverDefaultCipherSuites = getApplicableEnabledCipherSuites(
clientDefaultProtocols, true);
serverDefaultProtocols, false);
clientDefaultCipherSuites = getApplicableEnabledCipherSuites(
clientDefaultProtocols, true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ protected static final class ContextParameters {
* Get the client side parameters of SSLContext.
*/
protected ContextParameters getClientContextParameters() {
return new ContextParameters("TLCP", "PKIX", "NewSunX509");
return new ContextParameters("TLCP", "TencentPKIX", "PKIX");
}

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ protected static final class ContextParameters {
* Get the client side parameters of SSLContext.
*/
protected ContextParameters getClientContextParameters() {
return new ContextParameters("TLS", "PKIX", "NewSunX509");
return new ContextParameters("TLS", "TencentPKIX", "PKIX");
}

/*
Expand Down