| 1 | #cxx . . $ `<file>/mlspp/include/mls/crypto.h`/pragma once |
| 2 | |
| 3 | #include <hpke/digest.h>cxx . . $ `<file>/mlspp/lib/hpke/include/hpke/digest.h`/ |
| 4 | #include <hpke/hpke.h>cxx . . $ `<file>/mlspp/lib/hpke/include/hpke/hpke.h`/ |
| 5 | #include <hpke/random.h>cxx . . $ `<file>/mlspp/lib/hpke/include/hpke/random.h`/ |
| 6 | #include <hpke/signature.h>cxx . . $ `<file>/mlspp/lib/hpke/include/hpke/signature.h`/ |
| 7 | #include <mls/common.h>cxx . . $ `<file>/mlspp/include/mls/common.h`/ |
| 8 | #include <tls/tls_syntax.h>cxx . . $ `<file>/mlspp/lib/bytes/include/tls/tls_syntax.h`/ |
| 9 | #include <vector> |
| 10 | |
| 11 | namespace mlsppcxx . . $ mlspp/ { |
| 12 | |
| 13 | /// Signature Code points, borrowed from RFC 8446 |
| 14 | enum struct SignatureSchemecxx . . $ mlspp/SignatureScheme# : uint16_tcxx . . $ uint16_t# |
| 15 | { |
| 16 | ecdsa_secp256r1_sha256cxx . . $ mlspp/SignatureScheme#ecdsa_secp256r1_sha256. = 0x0403, |
| 17 | ecdsa_secp384r1_sha384cxx . . $ mlspp/SignatureScheme#ecdsa_secp384r1_sha384. = 0x0805, |
| 18 | ecdsa_secp521r1_sha512cxx . . $ mlspp/SignatureScheme#ecdsa_secp521r1_sha512. = 0x0603, |
| 19 | ed25519cxx . . $ mlspp/SignatureScheme#ed25519. = 0x0807, |
| 20 | ed448cxx . . $ mlspp/SignatureScheme#ed448. = 0x0808, |
| 21 | rsa_pkcs1_sha256cxx . . $ mlspp/SignatureScheme#rsa_pkcs1_sha256. = 0x0401, |
| 22 | }; |
| 23 | |
| 24 | SignatureSchemecxx . . $ mlspp/SignatureScheme# |
| 25 | tls_signature_schemecxx . . $ mlspp/tls_signature_scheme(902aafe9a6722bee).(hpkecxx . . $ mlspp/hpke/::Signaturecxx . . $ mlspp/hpke/Signature#::IDcxx . . $ mlspp/hpke/Signature#ID# id); |
| 26 | |
| 27 | /// Cipher suites |
| 28 | |
| 29 | struct KeyAndNoncecxx . . $ mlspp/KeyAndNonce# |
| 30 | { |
| 31 | bytescxx . . $ mlspp/bytes_ns/bytes# keycxx . . $ mlspp/KeyAndNonce#key.; |
| 32 | bytescxx . . $ mlspp/bytes_ns/bytes# noncecxx . . $ mlspp/KeyAndNonce#nonce.; |
| 33 | }; |
| 34 | |
| 35 | // opaque HashReference<V>; |
| 36 | // HashReference KeyPackageRef; |
| 37 | // HashReference ProposalRef; |
| 38 | using HashReferencecxx . . $ mlspp/HashReference# = bytescxx . . $ mlspp/bytes_ns/bytes#; |
| 39 | using KeyPackageRefcxx . . $ mlspp/KeyPackageRef# = HashReferencecxx . . $ mlspp/HashReference#; |
| 40 | using ProposalRefcxx . . $ mlspp/ProposalRef# = HashReferencecxx . . $ mlspp/HashReference#; |
| 41 | |
| 42 | struct CipherSuitecxx . . $ mlspp/CipherSuite# |
| 43 | { |
| 44 | enum struct IDcxx . . $ mlspp/CipherSuite#ID# : uint16_tcxx . . $ uint16_t# |
| 45 | { |
| 46 | unknowncxx . . $ mlspp/CipherSuite#ID#unknown. = 0x0000, |
| 47 | X25519_AES128GCM_SHA256_Ed25519cxx . . $ mlspp/CipherSuite#ID#X25519_AES128GCM_SHA256_Ed25519. = 0x0001, |
| 48 | P256_AES128GCM_SHA256_P256cxx . . $ mlspp/CipherSuite#ID#P256_AES128GCM_SHA256_P256. = 0x0002, |
| 49 | X25519_CHACHA20POLY1305_SHA256_Ed25519cxx . . $ mlspp/CipherSuite#ID#X25519_CHACHA20POLY1305_SHA256_Ed25519. = 0x0003, |
| 50 | X448_AES256GCM_SHA512_Ed448cxx . . $ mlspp/CipherSuite#ID#X448_AES256GCM_SHA512_Ed448. = 0x0004, |
| 51 | P521_AES256GCM_SHA512_P521cxx . . $ mlspp/CipherSuite#ID#P521_AES256GCM_SHA512_P521. = 0x0005, |
| 52 | X448_CHACHA20POLY1305_SHA512_Ed448cxx . . $ mlspp/CipherSuite#ID#X448_CHACHA20POLY1305_SHA512_Ed448. = 0x0006, |
| 53 | P384_AES256GCM_SHA384_P384cxx . . $ mlspp/CipherSuite#ID#P384_AES256GCM_SHA384_P384. = 0x0007, |
| 54 | |
| 55 | // GREASE values, included here mainly so that debugger output looks nice |
| 56 | GREASE_0cxx . . $ mlspp/CipherSuite#ID#GREASE_0. = 0x0A0A, |
| 57 | GREASE_1cxx . . $ mlspp/CipherSuite#ID#GREASE_1. = 0x1A1A, |
| 58 | GREASE_2cxx . . $ mlspp/CipherSuite#ID#GREASE_2. = 0x2A2A, |
| 59 | GREASE_3cxx . . $ mlspp/CipherSuite#ID#GREASE_3. = 0x3A3A, |
| 60 | GREASE_4cxx . . $ mlspp/CipherSuite#ID#GREASE_4. = 0x4A4A, |
| 61 | GREASE_5cxx . . $ mlspp/CipherSuite#ID#GREASE_5. = 0x5A5A, |
| 62 | GREASE_6cxx . . $ mlspp/CipherSuite#ID#GREASE_6. = 0x6A6A, |
| 63 | GREASE_7cxx . . $ mlspp/CipherSuite#ID#GREASE_7. = 0x7A7A, |
| 64 | GREASE_8cxx . . $ mlspp/CipherSuite#ID#GREASE_8. = 0x8A8A, |
| 65 | GREASE_9cxx . . $ mlspp/CipherSuite#ID#GREASE_9. = 0x9A9A, |
| 66 | GREASE_Acxx . . $ mlspp/CipherSuite#ID#GREASE_A. = 0xAAAA, |
| 67 | GREASE_Bcxx . . $ mlspp/CipherSuite#ID#GREASE_B. = 0xBABA, |
| 68 | GREASE_Ccxx . . $ mlspp/CipherSuite#ID#GREASE_C. = 0xCACA, |
| 69 | GREASE_Dcxx . . $ mlspp/CipherSuite#ID#GREASE_D. = 0xDADA, |
| 70 | GREASE_Ecxx . . $ mlspp/CipherSuite#ID#GREASE_E. = 0xEAEA, |
| 71 | }; |
| 72 | |
| 73 | CipherSuitecxx . . $ mlspp/CipherSuite#CipherSuite(49f6e7a06ebc5aa8).(); |
| 74 | CipherSuitecxx . . $ mlspp/CipherSuite#CipherSuite(674032a9b97054f8).(IDcxx . . $ mlspp/CipherSuite#ID# id_in); |
| 75 | |
| 76 | IDcxx . . $ mlspp/CipherSuite#ID# cipher_suitecxx . . $ mlspp/CipherSuite#cipher_suite(49aa5d40b84760c0).() const { return idcxx . . $ mlspp/CipherSuite#id.; } |
| 77 | SignatureSchemecxx . . $ mlspp/SignatureScheme# signature_schemecxx . . $ mlspp/CipherSuite#signature_scheme(25c8e3499195dd1).() const; |
| 78 | |
| 79 | size_t secret_sizecxx . . $ mlspp/CipherSuite#secret_size(fe4d2d262d4164a8).() const { return getcxx . . $ mlspp/CipherSuite#get(9d1ecf5d2a6cb924).().digestcxx . . $ mlspp/CipherSuite#Ciphers#digest..hash_sizecxx . . $ mlspp/hpke/Digest#hash_size.; } |
| 80 | size_t key_sizecxx . . $ mlspp/CipherSuite#key_size(fe4d2d262d4164a8).() const { return getcxx . . $ mlspp/CipherSuite#get(9d1ecf5d2a6cb924).().hpkecxx . . $ mlspp/CipherSuite#Ciphers#hpke..aeadcxx . . $ mlspp/hpke/HPKE#aead..key_sizecxx . . $ mlspp/hpke/AEAD#key_size.; } |
| 81 | size_t nonce_sizecxx . . $ mlspp/CipherSuite#nonce_size(fe4d2d262d4164a8).() const { return getcxx . . $ mlspp/CipherSuite#get(9d1ecf5d2a6cb924).().hpkecxx . . $ mlspp/CipherSuite#Ciphers#hpke..aeadcxx . . $ mlspp/hpke/HPKE#aead..nonce_sizecxx . . $ mlspp/hpke/AEAD#nonce_size.; } |
| 82 | |
| 83 | bytescxx . . $ mlspp/bytes_ns/bytes# zerocxx . . $ mlspp/CipherSuite#zero(d7392ba79aa35767).() const { return bytescxx . . $ mlspp/bytes_ns/bytes#bytes(913f486ae89fd8a8).(secret_sizecxx . . $ mlspp/CipherSuite#secret_size(fe4d2d262d4164a8).(), 0); } |
| 84 | const hpkecxx . . $ mlspp/hpke/::HPKEcxx . . $ mlspp/hpke/HPKE#& hpkecxx . . $ mlspp/CipherSuite#hpke(4248c68506dc683b).() const { return getcxx . . $ mlspp/CipherSuite#get(9d1ecf5d2a6cb924).().hpkecxx . . $ mlspp/CipherSuite#Ciphers#hpke.; } |
| 85 | const hpkecxx . . $ mlspp/hpke/::Digestcxx . . $ mlspp/hpke/Digest#& digestcxx . . $ mlspp/CipherSuite#digest(cdb80d7d9b9bc276).() const { return getcxx . . $ mlspp/CipherSuite#get(9d1ecf5d2a6cb924).().digestcxx . . $ mlspp/CipherSuite#Ciphers#digest.; } |
| 86 | const hpkecxx . . $ mlspp/hpke/::Signaturecxx . . $ mlspp/hpke/Signature#& sigcxx . . $ mlspp/CipherSuite#sig(aab2196748eae221).() const { return getcxx . . $ mlspp/CipherSuite#get(9d1ecf5d2a6cb924).().sigcxx . . $ mlspp/CipherSuite#Ciphers#sig.; } |
| 87 | |
| 88 | bytescxx . . $ mlspp/bytes_ns/bytes# expand_with_labelcxx . . $ mlspp/CipherSuite#expand_with_label(5537b899fa4f16b5).(const bytescxx . . $ mlspp/bytes_ns/bytes#& secret, |
| 89 | const stdcxx . . $ std/::stringcxx . . $ std/string#& label, |
| 90 | const bytescxx . . $ mlspp/bytes_ns/bytes#& context, |
| 91 | size_t length) const; |
| 92 | bytescxx . . $ mlspp/bytes_ns/bytes# derive_secretcxx . . $ mlspp/CipherSuite#derive_secret(5169660e3f01b6ab).(const bytescxx . . $ mlspp/bytes_ns/bytes#& secret, const stdcxx . . $ std/::stringcxx . . $ std/string#& label) const; |
| 93 | bytescxx . . $ mlspp/bytes_ns/bytes# derive_tree_secretcxx . . $ mlspp/CipherSuite#derive_tree_secret(bad54adf3f284450).(const bytescxx . . $ mlspp/bytes_ns/bytes#& secret, |
| 94 | const stdcxx . . $ std/::stringcxx . . $ std/string#& label, |
| 95 | uint32_tcxx . . $ uint32_t# generation, |
| 96 | size_t length) const; |
| 97 | |
| 98 | template<typename T> |
| 99 | bytescxx . . $ mlspp/bytes_ns/bytes# refcxx . . $ mlspp/CipherSuite#ref(b507ead0e101b284).(const T& value) const |
| 100 | { |
| 101 | return raw_refcxx . . $ mlspp/CipherSuite#raw_ref(802fe03ef4f7e693).(reference_labelcxx . . $ mlspp/CipherSuite#reference_label(f9dc8c7ea672a8f6).<T>(), tlscxx . . $ mlspp/tls/::marshalcxx . . $ mlspp/tls/marshal(7df0b13a9cabe487).(value)); |
| 102 | } |
| 103 | |
| 104 | bytescxx . . $ mlspp/bytes_ns/bytes# raw_refcxx . . $ mlspp/CipherSuite#raw_ref(802fe03ef4f7e693).(const bytescxx . . $ mlspp/bytes_ns/bytes#& label, const bytescxx . . $ mlspp/bytes_ns/bytes#& value) const |
| 105 | { |
| 106 | // RefHash(label, value) = Hash(RefHashInput) |
| 107 | // |
| 108 | // struct { |
| 109 | // opaque label<V>; |
| 110 | // opaque value<V>; |
| 111 | // } RefHashInput; |
| 112 | auto w = tlscxx . . $ mlspp/tls/::ostreamcxx . . $ mlspp/tls/ostream#(); |
| 113 | w <<cxx . . $ mlspp/tls/`operator<<`(412b32e9a88efffb). label <<cxx . . $ mlspp/tls/`operator<<`(412b32e9a88efffb). value; |
| 114 | return digestcxx . . $ mlspp/CipherSuite#digest(cdb80d7d9b9bc276).().hashcxx . . $ mlspp/hpke/Digest#hash(c5e1b85e16e94921).(wcxx . . $ mlspp/bytes_ns/bytes#bytes(981a1a29c6e5fab4)..bytescxx . . $ mlspp/tls/ostream#bytes(30469b417f2e3d73).()); |
| 115 | } |
| 116 | |
| 117 | TLS_SERIALIZABLEcxx . . $ mlspp/CipherSuite#_tls_fields_w(4ad60b5eca52a820).(id) |
| 118 | |
| 119 | private: |
| 120 | IDcxx . . $ mlspp/CipherSuite#ID# idcxx . . $ mlspp/CipherSuite#id.; |
| 121 | |
| 122 | struct Cipherscxx . . $ mlspp/CipherSuite#Ciphers# |
| 123 | { |
| 124 | hpkecxx . . $ mlspp/hpke/::HPKEcxx . . $ mlspp/hpke/HPKE# hpkecxx . . $ mlspp/CipherSuite#Ciphers#hpke.; |
| 125 | const hpkecxx . . $ mlspp/hpke/::Digestcxx . . $ mlspp/hpke/Digest#& digestcxx . . $ mlspp/CipherSuite#Ciphers#digest.; |
| 126 | const hpkecxx . . $ mlspp/hpke/::Signaturecxx . . $ mlspp/hpke/Signature#& sigcxx . . $ mlspp/CipherSuite#Ciphers#sig.; |
| 127 | }; |
| 128 | |
| 129 | const Cipherscxx . . $ mlspp/CipherSuite#Ciphers#& getcxx . . $ mlspp/CipherSuite#get(9d1ecf5d2a6cb924).() const; |
| 130 | |
| 131 | template<typename T> |
| 132 | static const bytescxx . . $ mlspp/bytes_ns/bytes#& reference_labelcxx . . $ mlspp/CipherSuite#reference_label(f9dc8c7ea672a8f6).(); |
| 133 | }; |
| 134 | |
| 135 | #if WITH_BORINGSSL |
| 136 | extern const std::array<CipherSuite::ID, 5> all_supported_suites; |
| 137 | #else |
| 138 | extern const stdcxx . . $ std/::arraycxx . . $ std/array#<CipherSuitecxx . . $ mlspp/CipherSuite#::IDcxx . . $ mlspp/CipherSuite#ID#, 7> all_supported_suitescxx . . $ mlspp/all_supported_suites.; |
| 139 | #endif |
| 140 | |
| 141 | // Utilities |
| 142 | using mlsppcxx . . $ mlspp/::hpkecxx . . $ mlspp/hpke/::random_bytescxx . . $ mlspp/random_bytes(b7161179e0ed6f95).; |
| 143 | |
| 144 | // HPKE Keys |
| 145 | namespace encrypt_labelcxx . . $ mlspp/encrypt_label/ { |
| 146 | extern const stdcxx . . $ std/::stringcxx . . $ std/string# update_path_nodecxx . . $ mlspp/encrypt_label/update_path_node.; |
| 147 | extern const stdcxx . . $ std/::stringcxx . . $ std/string# welcomecxx . . $ mlspp/encrypt_label/welcome.; |
| 148 | } // namespace encrypt_label |
| 149 | |
| 150 | struct HPKECiphertextcxx . . $ mlspp/HPKECiphertext# |
| 151 | { |
| 152 | bytescxx . . $ mlspp/bytes_ns/bytes# kem_outputcxx . . $ mlspp/HPKECiphertext#kem_output.; |
| 153 | bytescxx . . $ mlspp/bytes_ns/bytes# ciphertextcxx . . $ mlspp/HPKECiphertext#ciphertext.; |
| 154 | |
| 155 | TLS_SERIALIZABLEcxx . . $ mlspp/HPKECiphertext#kem_output.(kem_output, ciphertext) |
| 156 | }; |
| 157 | |
| 158 | struct HPKEPublicKeycxx . . $ mlspp/HPKEPublicKey# |
| 159 | { |
| 160 | bytescxx . . $ mlspp/bytes_ns/bytes# datacxx . . $ mlspp/HPKEPublicKey#data.; |
| 161 | |
| 162 | HPKECiphertextcxx . . $ mlspp/HPKECiphertext# encryptcxx . . $ mlspp/HPKEPublicKey#encrypt(4062c3a081c08efa).(CipherSuitecxx . . $ mlspp/CipherSuite# suite, |
| 163 | const stdcxx . . $ std/::stringcxx . . $ std/string#& label, |
| 164 | const bytescxx . . $ mlspp/bytes_ns/bytes#& context, |
| 165 | const bytescxx . . $ mlspp/bytes_ns/bytes#& pt) const; |
| 166 | |
| 167 | stdcxx . . $ std/::tuplecxx . . $ std/tuple#<bytescxx . . $ mlspp/bytes_ns/bytes#, bytescxx . . $ mlspp/bytes_ns/bytes#> do_exportcxx . . $ mlspp/HPKEPublicKey#do_export(10426ae6d3f47ac5).(CipherSuitecxx . . $ mlspp/CipherSuite# suite, |
| 168 | const bytescxx . . $ mlspp/bytes_ns/bytes#& info, |
| 169 | const stdcxx . . $ std/::stringcxx . . $ std/string#& label, |
| 170 | size_t size) const; |
| 171 | |
| 172 | TLS_SERIALIZABLEcxx . . $ std/forward_as_tuple(cd19fb0d9524ec73).(data) |
| 173 | }; |
| 174 | |
| 175 | struct HPKEPrivateKeycxx . . $ mlspp/HPKEPrivateKey# |
| 176 | { |
| 177 | static HPKEPrivateKeycxx . . $ mlspp/HPKEPrivateKey# generatecxx . . $ mlspp/HPKEPrivateKey#generate(4a2a6d1c0a9e0cd3).(CipherSuitecxx . . $ mlspp/CipherSuite# suite); |
| 178 | static HPKEPrivateKeycxx . . $ mlspp/HPKEPrivateKey# parsecxx . . $ mlspp/HPKEPrivateKey#parse(d8fbf663c4028288).(CipherSuitecxx . . $ mlspp/CipherSuite# suite, const bytescxx . . $ mlspp/bytes_ns/bytes#& data); |
| 179 | static HPKEPrivateKeycxx . . $ mlspp/HPKEPrivateKey# derivecxx . . $ mlspp/HPKEPrivateKey#derive(d8fbf663c4028288).(CipherSuitecxx . . $ mlspp/CipherSuite# suite, const bytescxx . . $ mlspp/bytes_ns/bytes#& secret); |
| 180 | |
| 181 | HPKEPrivateKeycxx . . $ mlspp/HPKEPrivateKey#HPKEPrivateKey(49f6e7a06ebc5aa8).() = default; |
| 182 | |
| 183 | bytescxx . . $ mlspp/bytes_ns/bytes# datacxx . . $ mlspp/HPKEPrivateKey#data.; |
| 184 | HPKEPublicKeycxx . . $ mlspp/HPKEPublicKey# public_keycxx . . $ mlspp/HPKEPrivateKey#public_key.; |
| 185 | |
| 186 | bytescxx . . $ mlspp/bytes_ns/bytes# decryptcxx . . $ mlspp/HPKEPrivateKey#decrypt(e80468221b998043).(CipherSuitecxx . . $ mlspp/CipherSuite# suite, |
| 187 | const stdcxx . . $ std/::stringcxx . . $ std/string#& label, |
| 188 | const bytescxx . . $ mlspp/bytes_ns/bytes#& context, |
| 189 | const HPKECiphertextcxx . . $ mlspp/HPKECiphertext#& ct) const; |
| 190 | |
| 191 | bytescxx . . $ mlspp/bytes_ns/bytes# do_exportcxx . . $ mlspp/HPKEPrivateKey#do_export(7d96ce105d93ef47).(CipherSuitecxx . . $ mlspp/CipherSuite# suite, |
| 192 | const bytescxx . . $ mlspp/bytes_ns/bytes#& info, |
| 193 | const bytescxx . . $ mlspp/bytes_ns/bytes#& kem_output, |
| 194 | const stdcxx . . $ std/::stringcxx . . $ std/string#& label, |
| 195 | size_t size) const; |
| 196 | |
| 197 | void set_public_keycxx . . $ mlspp/HPKEPrivateKey#set_public_key(1ae84ca71f879861).(CipherSuitecxx . . $ mlspp/CipherSuite# suite); |
| 198 | |
| 199 | TLS_SERIALIZABLEcxx . . $ `mlspp/lib/bytes/include/tls/tls_syntax.h:333:9`!(data) |
| 200 | |
| 201 | private: |
| 202 | HPKEPrivateKeycxx . . $ mlspp/HPKEPrivateKey#HPKEPrivateKey(6452a1c837d26c07).(bytescxx . . $ mlspp/bytes_ns/bytes# priv_data, bytescxx . . $ mlspp/bytes_ns/bytes# pub_data); |
| 203 | }; |
| 204 | |
| 205 | // Signature Keys |
| 206 | namespace sign_labelcxx . . $ mlspp/sign_label/ { |
| 207 | extern const stdcxx . . $ std/::stringcxx . . $ std/string# mls_contentcxx . . $ mlspp/sign_label/mls_content.; |
| 208 | extern const stdcxx . . $ std/::stringcxx . . $ std/string# leaf_nodecxx . . $ mlspp/sign_label/leaf_node.; |
| 209 | extern const stdcxx . . $ std/::stringcxx . . $ std/string# key_packagecxx . . $ mlspp/sign_label/key_package.; |
| 210 | extern const stdcxx . . $ std/::stringcxx . . $ std/string# group_infocxx . . $ mlspp/sign_label/group_info.; |
| 211 | extern const stdcxx . . $ std/::stringcxx . . $ std/string# multi_credentialcxx . . $ mlspp/sign_label/multi_credential.; |
| 212 | } // namespace sign_label |
| 213 | |
| 214 | struct SignaturePublicKeycxx . . $ mlspp/SignaturePublicKey# |
| 215 | { |
| 216 | static SignaturePublicKeycxx . . $ mlspp/SignaturePublicKey# from_jwkcxx . . $ mlspp/SignaturePublicKey#from_jwk(332579c13420cdc2).(CipherSuitecxx . . $ mlspp/CipherSuite# suite, |
| 217 | const stdcxx . . $ std/::stringcxx . . $ std/string#& json_str); |
| 218 | |
| 219 | bytescxx . . $ mlspp/bytes_ns/bytes# datacxx . . $ mlspp/SignaturePublicKey#data.; |
| 220 | |
| 221 | bool verifycxx . . $ mlspp/SignaturePublicKey#verify(e28f084f4f4fb6fe).(const CipherSuitecxx . . $ mlspp/CipherSuite#& suite, |
| 222 | const stdcxx . . $ std/::stringcxx . . $ std/string#& label, |
| 223 | const bytescxx . . $ mlspp/bytes_ns/bytes#& message, |
| 224 | const bytescxx . . $ mlspp/bytes_ns/bytes#& signature) const; |
| 225 | |
| 226 | stdcxx . . $ std/::stringcxx . . $ std/string# to_jwkcxx . . $ mlspp/SignaturePublicKey#to_jwk(e01dc7b933c172c2).(CipherSuitecxx . . $ mlspp/CipherSuite# suite) const; |
| 227 | |
| 228 | TLS_SERIALIZABLEcxx . . $ std/forward_as_tuple(cd19fb0d9524ec73).(data) |
| 229 | }; |
| 230 | |
| 231 | struct PublicJWKcxx . . $ mlspp/PublicJWK# |
| 232 | { |
| 233 | SignatureSchemecxx . . $ mlspp/SignatureScheme# signature_schemecxx . . $ mlspp/PublicJWK#signature_scheme.; |
| 234 | stdcxx . . $ std/::optionalcxx . . $ std/optional#<stdcxx . . $ std/::stringcxx . . $ std/string#> key_idcxx . . $ mlspp/PublicJWK#key_id.; |
| 235 | SignaturePublicKeycxx . . $ mlspp/SignaturePublicKey# public_keycxx . . $ mlspp/PublicJWK#public_key.; |
| 236 | |
| 237 | static PublicJWKcxx . . $ mlspp/PublicJWK# parsecxx . . $ mlspp/PublicJWK#parse(53a0670584dd2f31).(const stdcxx . . $ std/::stringcxx . . $ std/string#& jwk_json); |
| 238 | }; |
| 239 | |
| 240 | struct SignaturePrivateKeycxx . . $ mlspp/SignaturePrivateKey# |
| 241 | { |
| 242 | static SignaturePrivateKeycxx . . $ mlspp/SignaturePrivateKey# generatecxx . . $ mlspp/SignaturePrivateKey#generate(9eace4066238b439).(CipherSuitecxx . . $ mlspp/CipherSuite# suite); |
| 243 | static SignaturePrivateKeycxx . . $ mlspp/SignaturePrivateKey# parsecxx . . $ mlspp/SignaturePrivateKey#parse(2f8f1effe03d5e1a).(CipherSuitecxx . . $ mlspp/CipherSuite# suite, const bytescxx . . $ mlspp/bytes_ns/bytes#& data); |
| 244 | static SignaturePrivateKeycxx . . $ mlspp/SignaturePrivateKey# derivecxx . . $ mlspp/SignaturePrivateKey#derive(2f8f1effe03d5e1a).(CipherSuitecxx . . $ mlspp/CipherSuite# suite, const bytescxx . . $ mlspp/bytes_ns/bytes#& secret); |
| 245 | static SignaturePrivateKeycxx . . $ mlspp/SignaturePrivateKey# from_jwkcxx . . $ mlspp/SignaturePrivateKey#from_jwk(bf859b0d4268fccb).(CipherSuitecxx . . $ mlspp/CipherSuite# suite, |
| 246 | const stdcxx . . $ std/::stringcxx . . $ std/string#& json_str); |
| 247 | |
| 248 | SignaturePrivateKeycxx . . $ mlspp/SignaturePrivateKey#SignaturePrivateKey(ced63f7c635d850d).() = default; |
| 249 | |
| 250 | bytescxx . . $ mlspp/bytes_ns/bytes# datacxx . . $ mlspp/SignaturePrivateKey#data.; |
| 251 | SignaturePublicKeycxx . . $ mlspp/SignaturePublicKey# public_keycxx . . $ mlspp/SignaturePrivateKey#public_key.; |
| 252 | |
| 253 | bytescxx . . $ mlspp/bytes_ns/bytes# signcxx . . $ mlspp/SignaturePrivateKey#sign(9a20592b3b42a8ed).(const CipherSuitecxx . . $ mlspp/CipherSuite#& suite, |
| 254 | const stdcxx . . $ std/::stringcxx . . $ std/string#& label, |
| 255 | const bytescxx . . $ mlspp/bytes_ns/bytes#& message) const; |
| 256 | |
| 257 | void set_public_keycxx . . $ mlspp/SignaturePrivateKey#set_public_key(1ae84ca71f879861).(CipherSuitecxx . . $ mlspp/CipherSuite# suite); |
| 258 | stdcxx . . $ std/::stringcxx . . $ std/string# to_jwkcxx . . $ mlspp/SignaturePrivateKey#to_jwk(e01dc7b933c172c2).(CipherSuitecxx . . $ mlspp/CipherSuite# suite) const; |
| 259 | |
| 260 | TLS_SERIALIZABLEcxx . . $ `mlspp/lib/bytes/include/tls/tls_syntax.h:333:9`!(data) |
| 261 | |
| 262 | private: |
| 263 | SignaturePrivateKeycxx . . $ mlspp/SignaturePrivateKey#SignaturePrivateKey(6452a1c837d26c07).(bytescxx . . $ mlspp/bytes_ns/bytes# priv_data, bytescxx . . $ mlspp/bytes_ns/bytes# pub_data); |
| 264 | }; |
| 265 | |
| 266 | } // namespace mlspp |