VirtualBox

Changeset 73749 in vbox for trunk/include/iprt/crypto


Ignore:
Timestamp:
Aug 18, 2018 12:25:57 AM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
124432
Message:

IPRT/crypto: Implemented reading of PEM encrypted RSA keys. bugref:9152

Location:
trunk/include/iprt/crypto
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/crypto/key.h

    r73709 r73749  
    6666                                                                PRTERRINFO pErrInfo, const char *pszErrorTag);
    6767RTDECL(int)             RTCrKeyCreateFromPemSection(PRTCRKEY hKey, uint32_t fFlags, struct RTCRPEMSECTION const *pSection,
    68                                                     PRTERRINFO pErrInfo, const char *pszErrorTag);
     68                                                    const char *pszPassword, PRTERRINFO pErrInfo, const char *pszErrorTag);
    6969RTDECL(int)             RTCrKeyCreateFromBuffer(PRTCRKEY hKey, uint32_t fFlags, void const *pvSrc, size_t cbSrc,
    70                                                 PRTERRINFO pErrInfo, const char *pszErrorTag);
    71 RTDECL(int)             RTCrKeyCreateFromFile(PRTCRKEY hKey, uint32_t fFlags, const char *pszFilename, PRTERRINFO pErrInfo);
     70                                                const char *pszPassword, PRTERRINFO pErrInfo, const char *pszErrorTag);
     71RTDECL(int)             RTCrKeyCreateFromFile(PRTCRKEY hKey, uint32_t fFlags, const char *pszFilename,
     72                                              const char *pszPassword, PRTERRINFO pErrInfo);
    7273/** @todo add support for decrypting private keys.  */
    7374/** @name RTCRKEYFROM_F_XXX
  • trunk/include/iprt/crypto/pem.h

    r69105 r73749  
    6969/** Pointer to a const PEM marker. */
    7070typedef RTCRPEMMARKER const *PCRTCRPEMMARKER;
     71
     72
     73/**
     74 * A PEM field.
     75 */
     76typedef struct RTCRPEMFIELD
     77{
     78    /** Pointer to the next field. */
     79    struct RTCRPEMFIELD const *pNext;
     80    /** The field value. */
     81    char const         *pszValue;
     82    /** The field value length. */
     83    size_t              cchValue;
     84    /** The field name length. */
     85    size_t              cchName;
     86    /** The field name. */
     87    char                szName[RT_FLEXIBLE_ARRAY];
     88} RTCRPEMFIELD;
     89/** Pointer to a PEM field. */
     90typedef RTCRPEMFIELD *PRTCRPEMFIELD;
     91/** Pointer to a const PEM field. */
     92typedef RTCRPEMFIELD const *PCRTCRPEMFIELD;
    7193
    7294
     
    86108    /** The size of the binary data. */
    87109    size_t              cbData;
    88     /** Additional text preceeding the binary data. NULL if none. */
    89     char               *pszPreamble;
    90     /** The length of the preamble. */
    91     size_t              cchPreamble;
     110    /** List of fields, NULL if none. */
     111    PCRTCRPEMFIELD      pFieldHead;
     112    /** Set if RTCRPEMREADFILE_F_SENSITIVE was specified. */
     113    bool                fSensitive;
    92114} RTCRPEMSECTION;
    93115/** Pointer to a PEM section. */
     
    158180/** Only PEM sections, no binary fallback. */
    159181#define RTCRPEMREADFILE_F_ONLY_PEM                      RT_BIT(1)
     182/** Sensitive data, use the safer allocator. */
     183#define RTCRPEMREADFILE_F_SENSITIVE                     RT_BIT(2)
    160184/** Valid flags. */
    161 #define RTCRPEMREADFILE_F_VALID_MASK                    UINT32_C(0x00000003)
     185#define RTCRPEMREADFILE_F_VALID_MASK                    UINT32_C(0x00000007)
    162186/** @} */
    163187
Note: See TracChangeset for help on using the changeset viewer.

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