CoolrfulDARkness/moontlcp/state does not have a README file
pub suberror StateError {
ProtocolError(AlertDescription, String)
RecordError(String)
CertificateError(String)
CryptoError(String)
InvalidState(String)
} derive(Eq, Debug)pub(all) struct ClientConfig {
trust_anchors : Array[Certificate]
cipher_suites : Array[CipherSuite]
client_certs : (Certificate, PrivateKey, Certificate, PrivateKey)?
resume_session : ResumedSession?
seed : Bytes
}pub struct ClientConn {
config : ClientConfig
prng : Prng
state : ClientState
read_layer : RecordLayer
write_layer : RecordLayer
write_encrypted : Bool
inbound : Array[Byte]
hs_buf : Array[Byte]
outbound : Array[Byte]
transcript : Transcript
client_random : Bytes
server_random : Bytes
session_id : Bytes
suite : CipherSuite?
peer_bundle : DualCertBundle?
server_eph_pub : PublicKey?
cert_requested : Bool
master_secret : Bytes
key_block : KeyBlock?
resumed : Bool
local_closed : Bool
peer_closed : Bool
}pub(all) enum Event {
HandshakeComplete
ApplicationData(Bytes)
PeerClosed
WarningAlert(AlertDescription)
} derive(Eq, Debug)pub(all) struct ResumedSession {
session_id : Bytes
cipher_suite : CipherSuite
master_secret : Bytes
peer_certs : DualCertBundle?
} derive(Eq, Debug)pub(all) struct ServerConfig {
sign_cert : Certificate
sign_priv : PrivateKey
enc_cert : Certificate
enc_priv : PrivateKey
cipher_suites : Array[CipherSuite]
require_client_cert : Bool
client_trust_anchors : Array[Certificate]
session_store : SessionStore?
seed : Bytes
}fn ServerConfig::new(sign_cert : Certificate, sign_priv : PrivateKey, enc_cert : Certificate, enc_priv : PrivateKey, seed : Bytes) -> ServerConfigpub struct ServerConn {
config : ServerConfig
prng : Prng
state : ServerState
read_layer : RecordLayer
write_layer : RecordLayer
write_encrypted : Bool
inbound : Array[Byte]
hs_buf : Array[Byte]
outbound : Array[Byte]
transcript : Transcript
client_random : Bytes
server_random : Bytes
session_id : Bytes
suite : CipherSuite?
peer_bundle : DualCertBundle?
server_eph_priv : PrivateKey?
client_cert_requested : Bool
master_secret : Bytes
key_block : KeyBlock?
resumed : Bool
local_closed : Bool
peer_closed : Bool
}Install
Download zipPure MoonBit, zero-FFI, unified Chinese national standard cryptography stack: Sans-I/O GM/T 0024-2023 (TLCP 1.1) dual-certificate protocol + GB/T 38635-2020 SM9 BN256 identity-based cryptography over a shared SM3/SM4/CT core.