React Native
React Native
Enumerate Server-Advertised Acceptable Client CAs
See more Socket/SSL/TLS Examples
Demonstrates Socket.GetSslAcceptableClientCaDn, which returns a certificate-authority distinguished name advertised by a TLS server when it requests a client certificate.
Background. Valid indexes range from 0 through
NumSslAcceptableClientCAs minus one. A client can use these names to select an appropriate client certificate.Chilkat React Native Downloads
import { Socket } from '@chilkat/react-native'
async function chilkatExample() {
const socket = new Socket();
// Connect to the server using TLS.
const bTls = true;
const maxWaitMs = 5000;
try {
await socket.connectAsync('example.com', 5000, bTls, maxWaitMs);
} catch {
console.log(socket.lastErrorText);
return;
}
// After connecting to a server that requests a client certificate, enumerate the certificate-
// authority distinguished names the server advertised as acceptable.
const numCAs = socket.numSslAcceptableClientCAs;
for (let i = 0; i < numCAs; i++) {
let caDn: string;
try {
caDn = socket.getSslAcceptableClientCaDn(i);
} catch {
console.log(socket.lastErrorText);
return;
}
console.log(caDn);
}
}