Changeset 104541 in vbox
- Timestamp:
- May 8, 2024 8:32:59 AM (9 months ago)
- Location:
- trunk
- Files:
-
- 1 deleted
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/crypto/x509.h
r104538 r104541 1212 1212 RTDECL(PCRTCRX509CERTIFICATE) RTCrX509CertPathsGetPathNodeCert(RTCRX509CERTPATHS hCertPaths, uint32_t iPath, uint32_t iNode); 1213 1213 1214 /**1215 * Generates and signs a certificate.1216 */1217 RTDECL(int) RTCrX509Certificate_Generate(const char *pszServerCertificate, const char *pszServerPrivateKey);1218 1214 1219 1215 RT_C_DECLS_END … … 1224 1220 1225 1221 #endif /* !IPRT_INCLUDED_crypto_x509_h */ 1222 -
trunk/include/iprt/mangling.h
r104538 r104541 4091 4091 # define RTCrX509Certificate_VerifySignature RT_MANGLER(RTCrX509Certificate_VerifySignature) 4092 4092 # define RTCrX509Certificate_VerifySignatureSelfSigned RT_MANGLER(RTCrX509Certificate_VerifySignatureSelfSigned) 4093 # define RTCrX509Certificate_Generate RT_MANGLER(RTCrX509Certificate_Generate)4094 4093 # define RTCrTafCertPathControls_DecodeAsn1 RT_MANGLER(RTCrTafCertPathControls_DecodeAsn1) 4095 4094 # define RTCrTafTrustAnchorChoice_DecodeAsn1 RT_MANGLER(RTCrTafTrustAnchorChoice_DecodeAsn1) … … 4391 4390 4392 4391 #endif /* !IPRT_INCLUDED_mangling_h */ 4392 -
trunk/src/VBox/Main/include/VRDEServerImpl.h
r104537 r104541 60 60 HRESULT i_loadSettings(const settings::VRDESettings &data); 61 61 HRESULT i_saveSettings(settings::VRDESettings &data); 62 HRESULT i_generateServerCertificate();63 62 void i_rollback(); 64 63 void i_commit(); -
trunk/src/VBox/Main/src-server/VRDEServerImpl.cpp
r104537 r104541 38 38 #include <iprt/ldr.h> 39 39 #include <iprt/path.h> 40 #include <iprt/crypto/x509.h>41 40 42 41 #include <VBox/err.h> … … 234 233 } 235 234 236 /**237 * Auto-generates a self-signed certificate for the VM.238 *239 * @note Locks this object for writing.240 */241 HRESULT VRDEServer::i_generateServerCertificate()242 {243 Utf8Str strServerCertificate = "server_cert.pem";244 Utf8Str strServerPrivateKey = "server_key_private.pem";245 mParent->i_calculateFullPath(strServerCertificate, strServerCertificate);246 mParent->i_calculateFullPath(strServerPrivateKey, strServerPrivateKey);247 const char *pszServerCertificate = strServerCertificate.c_str();248 const char *pszServerPrivateKey = strServerPrivateKey.c_str();249 250 HRESULT hrc = RTCrX509Certificate_Generate(pszServerCertificate, pszServerPrivateKey);251 252 if (SUCCEEDED(hrc))253 {254 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);255 mData.backup();256 257 mData->mapProperties["Security/Method"] = Utf8Str("TLS");258 mData->mapProperties["Security/ServerCertificate"] = strServerCertificate;259 mData->mapProperties["Security/ServerPrivateKey"] = strServerPrivateKey;260 261 /* Done with the properties access. */262 alock.release();263 }264 return hrc;265 }266 267 235 // IVRDEServer properties 268 236 ///////////////////////////////////////////////////////////////////////////// … … 294 262 /* leave the lock before informing callbacks */ 295 263 alock.release(); 296 297 /*298 * If TLS is not explicitely disabled then auto-generate299 * a self-signed certificate for this VM.300 */301 if (mData->mapProperties["Security/Method"] != "RDP")302 {303 hrc = i_generateServerCertificate();304 if (FAILED(hrc))305 {306 LogRel(("Failed to auto generate server key and certificate: (%Rrc)\n", hrc));307 }308 }309 264 310 265 AutoWriteLock mlock(mParent COMMA_LOCKVAL_SRC_POS); // mParent is const, needs no locking -
trunk/src/VBox/Runtime/Makefile.kmk
r104537 r104541 478 478 common/crypto/x509-certpaths.cpp \ 479 479 common/crypto/x509-core.cpp \ 480 common/crypto/x509-create-sign.cpp \481 480 common/crypto/x509-file.cpp \ 482 481 common/crypto/x509-init.cpp \ … … 2358 2357 common/crypto/x509-certpaths.cpp \ 2359 2358 common/crypto/x509-core.cpp \ 2360 common/crypto/x509-create-sign.cpp \2361 2359 common/crypto/x509-file.cpp \ 2362 2360 common/crypto/x509-init.cpp \ … … 3764 3762 common/crypto/x509-certpaths.cpp \ 3765 3763 common/crypto/x509-core.cpp \ 3766 common/crypto/x509-create-sign.cpp \3767 3764 common/crypto/x509-init.cpp \ 3768 3765 common/crypto/x509-sanity.cpp \ … … 3918 3915 common/crypto/x509-certpaths.cpp \ 3919 3916 common/crypto/x509-core.cpp \ 3920 common/crypto/x509-create-sign.cpp \3921 3917 common/crypto/x509-init.cpp \ 3922 3918 common/crypto/x509-sanity.cpp \
Note:
See TracChangeset
for help on using the changeset viewer.