Changeset 100493 in vbox for trunk/src/VBox/Runtime/common/crypto
- Timestamp:
- Jul 10, 2023 11:17:15 PM (19 months ago)
- Location:
- trunk/src/VBox/Runtime/common/crypto
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/crypto/key-file.cpp
r100421 r100493 471 471 472 472 case kKeyFormat_PrivateKeyInfo: 473 { 473 474 RTAsn1CursorInitPrimary(&PrimaryCursor, pSection->pbData, (uint32_t)pSection->cbData, 474 475 pErrInfo, &g_RTAsn1DefaultAllocator, RTASN1CURSOR_FLAGS_DER, pszErrorTag); … … 479 480 if (RT_SUCCESS(rc)) 480 481 { 481 /* 482 * Check if the algorithm is pkcs1-RsaEncryption 482 /* 483 * Load the private key according to it's algorithm. 484 * We currently only support RSA (pkcs1-RsaEncryption). 483 485 */ 484 if (strcmp(PrivateKeyInfo.PrivateKeyAlgorithm.Algorithm.szObjId,"1.2.840.113549.1.1.1") == 0) 485 { 486 uint32_t cbContent = PrivateKeyInfo.PrivateKey.Asn1Core.cb; 487 rc = rtCrKeyCreateRsaPrivate(phKey, PrivateKeyInfo.PrivateKey.Asn1Core.uData.pv, cbContent, pErrInfo, pszErrorTag); 488 } 486 if (RTAsn1ObjId_CompareWithString(&PrivateKeyInfo.PrivateKeyAlgorithm.Algorithm, 487 RTCRX509ALGORITHMIDENTIFIERID_RSA) == 0) 488 rc = rtCrKeyCreateRsaPrivate(phKey, PrivateKeyInfo.PrivateKey.Asn1Core.uData.pv, 489 PrivateKeyInfo.PrivateKey.Asn1Core.cb, pErrInfo, pszErrorTag); 489 490 else 490 {491 491 rc = RTErrInfoSet(pErrInfo, VERR_CR_KEY_FORMAT_NOT_SUPPORTED, 492 "Support for PKCS#8 PrivateKeyInfo (with no RSA encryption) is not yet implemented"); 493 } 492 "Support for PKCS#8 PrivateKeyInfo for non-RSA keys is not yet implemented"); 494 493 } 495 494 break; 495 } 496 496 497 497 case kKeyFormat_EncryptedPrivateKeyInfo: -
trunk/src/VBox/Runtime/common/crypto/pkcs8-internal.h
r100421 r100493 41 41 #endif 42 42 43 /** The max number of bits we support in the modulus. */44 #define RTCRRSA_MAX_MODULUS_BITS 1638445 46 43 #define RTASN1TMPL_TEMPLATE_FILE "../common/crypto/pkcs8-template.h" 47 44 #include <iprt/asn1-generator-internal-header.h> -
trunk/src/VBox/Runtime/common/crypto/pkcs8-template.h
r100421 r100493 42 42 #define RTASN1TMPL_TYPE RTCRPKCS8PRIVATEKEYINFO 43 43 #define RTASN1TMPL_EXT_NAME RTCrPkcs8PrivateKeyInfo 44 #define RTASN1TMPL_INT_NAME rTCrPkcs8PrivateKeyInfo44 #define RTASN1TMPL_INT_NAME RTCrPkcs8PrivateKeyInfo 45 45 RTASN1TMPL_BEGIN_SEQCORE(); 46 46 RTASN1TMPL_MEMBER( Version, RTASN1INTEGER, RTAsn1Integer);
Note:
See TracChangeset
for help on using the changeset viewer.