Changeset 100493 in vbox
- Timestamp:
- Jul 10, 2023 11:17:15 PM (17 months ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/crypto/pkcs8.h
r100425 r100493 48 48 49 49 /** @defgroup grp_rt_crpkcs8 RTCrPkcs8 - PKCS \#8, Private-Key Information Syntax Standard 50 * 51 * See RFC-5208 for details. 52 * 50 53 * @ingroup grp_rt_crypto 51 54 * @{ … … 54 57 /** 55 58 * PKCS\#8 PrivateKeyInfo. 59 * 60 * See RFC-5208 section 5. 56 61 */ 57 /** @todo bird: rename to RTCRPKCS8PRIVATEKEYINFO. Should eventually be moved58 * into a new iprt/crypto/pkcs8.h header file. Ditto for the template59 * and associated code instantiation/whatever. */60 62 typedef struct RTCRPKCS8PRIVATEKEYINFO 61 63 { … … 66 68 /** The private key algorithm. */ 67 69 RTCRX509ALGORITHMIDENTIFIER PrivateKeyAlgorithm; 68 /** The private key. */ 70 /** The private key, according to PrivateKeyAlgorithm. 71 * For RSA there is RSAPrivateKey (in BER encoding) embedded in this string. */ 69 72 RTASN1OCTETSTRING PrivateKey; 70 73 /** Attributes, optional [0]. … … 82 85 /** 83 86 * PKCS\#8 EncryptedPrivateKeyInfo. 87 * 88 * See RFC-5208 section 6. 84 89 */ 85 90 typedef struct RTCRENCRYPTEDPRIVATEKEY -
trunk/include/iprt/mangling.h
r100490 r100493 4321 4321 # define g_aRTCrPkcs7Markers RT_MANGLER(g_aRTCrPkcs7Markers) 4322 4322 # define g_cRTCrPkcs7Markers RT_MANGLER(g_cRTCrPkcs7Markers) 4323 # define g_ rTCrPkcs8PrivateKeyInfo_Vtable RT_MANGLER(g_rTCrPkcs8PrivateKeyInfo_Vtable)4323 # define g_RTCrPkcs8PrivateKeyInfo_Vtable RT_MANGLER(g_RTCrPkcs8PrivateKeyInfo_Vtable) 4324 4324 # define g_aRTCrX509CertificateMarkers RT_MANGLER(g_aRTCrX509CertificateMarkers) 4325 4325 # define g_cRTCrX509CertificateMarkers RT_MANGLER(g_cRTCrX509CertificateMarkers) -
trunk/src/VBox/Runtime/Makefile.kmk
r100442 r100493 3719 3719 common/crypto/pkcs7-sanity.cpp \ 3720 3720 common/crypto/pkcs7-verify.cpp \ 3721 common/crypto/pkcs8-asn1-decoder.cpp \3722 common/crypto/pkcs8-core.cpp \3723 common/crypto/pkcs8-init.cpp \3724 common/crypto/pkcs8-sanity.cpp \3725 3721 common/crypto/pkix-signature-builtin.cpp \ 3726 3722 common/crypto/pkix-signature-core.cpp \ … … 3876 3872 common/crypto/pkcs7-sanity.cpp \ 3877 3873 common/crypto/pkcs7-verify.cpp \ 3878 common/crypto/pkcs8-asn1-decoder.cpp \3879 common/crypto/pkcs8-core.cpp \3880 common/crypto/pkcs8-init.cpp \3881 common/crypto/pkcs8-sanity.cpp \3882 3874 common/crypto/pkix-signature-builtin.cpp \ 3883 3875 common/crypto/pkix-signature-core.cpp \ -
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.