VirtualBox

Ignore:
Timestamp:
Sep 16, 2018 3:36:08 PM (6 years ago)
Author:
vboxsync
Message:

IPRT/crypto: Wrapped SSL, alleged RC4, and RSA key generation. Added methods for quering someRSA key components. Exposed big numbers, x509 and asn1 APIs as stable. bugref:9246

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/crypto/key.cpp

    r74052 r74295  
    357357}
    358358
     359
     360RTDECL(int) RTCrKeyQueryRsaModulus(RTCRKEY hKey, PRTBIGNUM pModulus)
     361{
     362    PRTCRKEYINT pThis = hKey;
     363    AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
     364    AssertReturn(pThis->u32Magic == RTCRKEYINT_MAGIC, VERR_INVALID_HANDLE);
     365    AssertReturn(pThis->enmType == RTCRKEYTYPE_RSA_PRIVATE || pThis->enmType == RTCRKEYTYPE_RSA_PUBLIC, VERR_WRONG_TYPE);
     366    AssertPtrReturn(pModulus, VERR_INVALID_POINTER);
     367
     368    if (pThis->enmType == RTCRKEYTYPE_RSA_PRIVATE)
     369        return RTBigNumAssign(pModulus, &pThis->u.RsaPrivate.Modulus);
     370    return RTBigNumAssign(pModulus, &pThis->u.RsaPublic.Modulus);
     371}
     372
     373
     374RTDECL(int) RTCrKeyQueryRsaPrivateExponent(RTCRKEY hKey, PRTBIGNUM pPrivateExponent)
     375{
     376    PRTCRKEYINT pThis = hKey;
     377    AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
     378    AssertReturn(pThis->u32Magic == RTCRKEYINT_MAGIC, VERR_INVALID_HANDLE);
     379    AssertReturn(pThis->enmType == RTCRKEYTYPE_RSA_PRIVATE, VERR_WRONG_TYPE);
     380    AssertPtrReturn(pPrivateExponent, VERR_INVALID_POINTER);
     381
     382    return RTBigNumAssign(pPrivateExponent, &pThis->u.RsaPrivate.PrivateExponent);
     383}
     384
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette