Changeset 73665 in vbox for trunk/include
- Timestamp:
- Aug 14, 2018 5:49:23 PM (6 years ago)
- Location:
- trunk/include/iprt
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/crypto/pkix.h
r69105 r73665 32 32 RT_C_DECLS_BEGIN 33 33 34 struct RTCRX509SUBJECTPUBLICKEYINFO; 35 34 36 /** @defgroup grp_rt_crpkix RTCrPkix - Public Key Infrastructure APIs 35 37 * @ingroup grp_rt_crypto … … 43 45 * @returns IPRT status code. 44 46 * @param pAlgorithm The signature algorithm (digest w/ cipher). 47 * @param hPublicKey The public key. 45 48 * @param pParameters Parameter to the public key algorithm. Optional. 46 * @param pPublicKey The public key.47 49 * @param pSignatureValue The signature value. 48 50 * @param pvData The signed data. … … 53 55 * performed more than once using all available crypto implementations. 54 56 */ 55 RTDECL(int) RTCrPkixPubKeyVerifySignature(PCRTASN1OBJID pAlgorithm, PCRTASN1DYNTYPE pParameters, PCRTASN1BITSTRING pPublicKey,57 RTDECL(int) RTCrPkixPubKeyVerifySignature(PCRTASN1OBJID pAlgorithm, RTCRKEY hPublicKey, PCRTASN1DYNTYPE pParameters, 56 58 PCRTASN1BITSTRING pSignatureValue, const void *pvData, size_t cbData, 57 59 PRTERRINFO pErrInfo); … … 64 66 * @returns IPRT status code. 65 67 * @param pAlgorithm The signature algorithm (digest w/ cipher). 68 * @param hPublicKey The public key. 66 69 * @param pParameters Parameter to the public key algorithm. Optional. 67 * @param pPublicKey The public key.68 70 * @param pvSignedDigest The signed digest. 69 71 * @param cbSignedDigest The signed digest size. … … 75 77 * performed more than once using all available crypto implementations. 76 78 */ 77 RTDECL(int) RTCrPkixPubKeyVerifySignedDigest(PCRTASN1OBJID pAlgorithm, PCRTASN1DYNTYPE pParameters,78 PCRTASN1BITSTRING pPublicKey,void const *pvSignedDigest, size_t cbSignedDigest,79 RTDECL(int) RTCrPkixPubKeyVerifySignedDigest(PCRTASN1OBJID pAlgorithm, RTCRKEY hPublicKey, PCRTASN1DYNTYPE pParameters, 80 void const *pvSignedDigest, size_t cbSignedDigest, 79 81 RTCRDIGEST hDigest, PRTERRINFO pErrInfo); 80 82 83 /** 84 * Wrapper around RTCrPkixPubKeyVerifySignedDigest & RTCrKeyCreateFromAlgorithmAndBits. 85 * 86 * @note The public key info must include digest type for this to work. 87 */ 88 RTDECL(int) RTCrPkixPubKeyVerifySignedDigestByCertPubKeyInfo(struct RTCRX509SUBJECTPUBLICKEYINFO const *pCertPubKeyInfo, 89 void const *pvSignedDigest, size_t cbSignedDigest, 90 RTCRDIGEST hDigest, PRTERRINFO pErrInfo); 91 92 93 /** 94 * Signs a digest (@a hDigest) using the specified private key (@a pPrivateKey) and algorithm. 95 * 96 * @returns IPRT status code. 97 * @param pAlgorithm The signature algorithm (digest w/ cipher). 98 * @param hPrivateKey Handle to the private key to use. 99 * @param pParameters Parameter to the public key algorithm. Optional. 100 * @param hDigest The digest of the data being signed. 101 * @param fFlags Flags for future extensions, MBZ. 102 * @param pvSignature The output signature buffer. Pass NULL to query 103 * the signature size. 104 * @param pcbSignature On input the variable pointed to holds the size of 105 * the buffer @a pvSignature points to. 106 * On return the variable pointed to is set to the size 107 * of the returned signature, or the required size in 108 * case of VERR_BUFFER_OVERFLOW. 109 * @param pErrInfo Where to return extended error info. Optional. 110 * 111 * @remarks Depending on the IPRT build configuration and the algorithm used, the 112 * signing may be performed more than once using all available crypto 113 * implementations. 114 */ 115 RTDECL(int) RTCrPkixPubKeySignDigest(PCRTASN1OBJID pAlgorithm, RTCRKEY hPrivateKey, PCRTASN1DYNTYPE pParameters, 116 RTCRDIGEST hDigest, uint32_t fFlags, 117 void *pvSignature, size_t *pcbSignature, PRTERRINFO pErrInfo); 81 118 82 119 /** … … 141 178 * setting for the lifetime of the instance due to the 142 179 * algorithm requiring different keys. 143 * @param pKey The key to use (whether private or public depends on144 * the operation).180 * @param hKey The key handle. Caller has retained it for the 181 * lifetime of the state being initialize. 145 182 * @param pParams Algorithm/key parameters, optional. Will be NULL if 146 183 * none. 147 184 */ 148 185 DECLCALLBACKMEMBER(int, pfnInit)(struct RTCRPKIXSIGNATUREDESC const *pDesc, void *pvState, void *pvOpaque, bool fSigning, 149 PCRTASN1BITSTRING pKey, PCRTASN1DYNTYPE pParams);186 RTCRKEY hKey, PCRTASN1DYNTYPE pParams); 150 187 151 188 /** … … 183 220 * @param pDesc Pointer to this structure (for uProviderSpecific). 184 221 * @param pvState The opaque provider state. 222 * @param hKey The key handle associated with the state at init. 185 223 * @param hDigest The handle to the digest. Call RTCrDigestFinal to 186 224 * complete and retreive the final hash value. … … 188 226 * @param cbSignature The size of the signature (in bytes). 189 227 */ 190 DECLCALLBACKMEMBER(int, pfnVerify)(struct RTCRPKIXSIGNATUREDESC const *pDesc, void *pvState, 228 DECLCALLBACKMEMBER(int, pfnVerify)(struct RTCRPKIXSIGNATUREDESC const *pDesc, void *pvState, RTCRKEY hKey, 191 229 RTCRDIGEST hDigest, void const *pvSignature, size_t cbSignature); 192 230 … … 202 240 * @param pDesc Pointer to this structure (for uProviderSpecific). 203 241 * @param pvState The opaque provider state. 242 * @param hKey The key handle associated with the state at init. 204 243 * @param hDigest The handle to the digest. Call RTCrDigestFinal to 205 244 * complete and retreive the final hash value. … … 211 250 * case of VERR_BUFFER_OVERFLOW. 212 251 */ 213 DECLCALLBACKMEMBER(int, pfnSign)(struct RTCRPKIXSIGNATUREDESC const *pDesc, void *pvState, 252 DECLCALLBACKMEMBER(int, pfnSign)(struct RTCRPKIXSIGNATUREDESC const *pDesc, void *pvState, RTCRKEY hKey, 214 253 RTCRDIGEST hDigest, void *pvSignature, size_t *pcbSignature); 215 254 … … 220 259 221 260 PCRTCRPKIXSIGNATUREDESC RTCrPkixSignatureFindByObjIdString(const char *pszObjId, void *ppvOpaque); 222 PCRTCRPKIXSIGNATUREDESC RTCrPkixSignatureFindByObjId(PCRTASN1OBJID pObjId, void * ppvOpaque);261 PCRTCRPKIXSIGNATUREDESC RTCrPkixSignatureFindByObjId(PCRTASN1OBJID pObjId, void **ppvOpaque); 223 262 RTDECL(int) RTCrPkixSignatureCreateByObjIdString(PRTCRPKIXSIGNATURE phSignature, const char *pszObjId, bool fSigning, 224 PCRTASN1BITSTRING pKey,PCRTASN1DYNTYPE pParams);225 RTDECL(int) RTCrPkixSignatureCreateByObjId(PRTCRPKIXSIGNATURE phSignature, PCRTASN1OBJID pObjId, bool fSigning,226 PCRTASN1 BITSTRING pKey, PCRTASN1DYNTYPE pParams);263 RTCRKEY hKey, PCRTASN1DYNTYPE pParams); 264 RTDECL(int) RTCrPkixSignatureCreateByObjId(PRTCRPKIXSIGNATURE phSignature, PCRTASN1OBJID pObjId, RTCRKEY hKey, 265 PCRTASN1DYNTYPE pParams, bool fSigning); 227 266 228 267 229 268 RTDECL(int) RTCrPkixSignatureCreate(PRTCRPKIXSIGNATURE phSignature, PCRTCRPKIXSIGNATUREDESC pDesc, void *pvOpaque, 230 bool fSigning, PCRTASN1BITSTRING pKey, PCRTASN1DYNTYPE pParams);269 bool fSigning, RTCRKEY hKey, PCRTASN1DYNTYPE pParams); 231 270 RTDECL(uint32_t) RTCrPkixSignatureRetain(RTCRPKIXSIGNATURE hSignature); 232 271 RTDECL(uint32_t) RTCrPkixSignatureRelease(RTCRPKIXSIGNATURE hSignature); -
trunk/include/iprt/err.h
r73494 r73665 2729 2729 /** The EVP_PKEY_type API in OpenSSL failed. */ 2730 2730 #define VERR_CR_PKIX_OSSL_EVP_PKEY_TYPE_ERROR (-23517) 2731 /** OpenSSL failed to decode the public key. */ 2732 #define VERR_CR_PKIX_OSSL_D2I_PRIVATE_KEY_FAILED (-23518) 2733 /** The EVP_PKEY_CTX_set_rsa_padding API in OpenSSL failed. */ 2734 #define VERR_CR_PKIX_OSSL_EVP_PKEY_RSA_PAD_ERROR (-23519) 2735 /** Final OpenSSL PKIX signing failed. */ 2736 #define VERR_CR_PKIX_OSSL_SIGN_FINAL_FAILED (-23520) 2737 /** OpenSSL and IPRT disagree on the signature size. */ 2738 #define VERR_CR_PKIX_OSSL_VS_IPRT_SIGNATURE_SIZE (-23521) 2739 /** OpenSSL and IPRT disagree on the signature. */ 2740 #define VERR_CR_PKIX_OSSL_VS_IPRT_SIGNATURE (-23522) 2741 /** Expected RSA private key. */ 2742 #define VERR_CR_PKIX_NOT_RSA_PRIVATE_KEY (-23523) 2743 /** Expected RSA public key. */ 2744 #define VERR_CR_PKIX_NOT_RSA_PUBLIC_KEY (-23524) 2731 2745 /** @} */ 2732 2746 … … 2735 2749 /** Generic store error. */ 2736 2750 #define VERR_CR_STORE_GENERIC_ERROR (-23700) 2751 /** @} */ 2752 2753 /** @name RTCrKey status codes. 2754 * @{ */ 2755 /** Could not recognize the key type. */ 2756 #define VERR_CR_KEY_UNKNOWN_TYPE (-23800) 2757 /** Unsupported key format. */ 2758 #define VERR_CR_KEY_FORMAT_NOT_SUPPORTED (-23801) 2737 2759 /** @} */ 2738 2760 -
trunk/include/iprt/mangling.h
r73662 r73665 3111 3111 # define RTCrDigestTypeToName RT_MANGLER(RTCrDigestTypeToName) 3112 3112 # define RTCrDigestTypeToHashSize RT_MANGLER(RTCrDigestTypeToHashSize) 3113 # define RTCrKeyCreateFromBuffer RT_MANGLER(RTCrKeyCreateFromBuffer) 3114 # define RTCrKeyCreateFromFile RT_MANGLER(RTCrKeyCreateFromFile) 3115 # define RTCrKeyCreateFromPemSection RT_MANGLER(RTCrKeyCreateFromPemSection) 3116 # define RTCrKeyCreateFromPublicAlgorithmAndBits RT_MANGLER(RTCrKeyCreateFromPublicAlgorithmAndBits) 3117 # define RTCrKeyCreateFromSubjectPublicKeyInfo RT_MANGLER(RTCrKeyCreateFromSubjectPublicKeyInfo) 3118 # define RTCrKeyGetBitCount RT_MANGLER(RTCrKeyGetBitCount) 3119 # define RTCrKeyGetType RT_MANGLER(RTCrKeyGetType) 3120 # define RTCrKeyHasPrivatePart RT_MANGLER(RTCrKeyHasPrivatePart) 3121 # define RTCrKeyHasPublicPart RT_MANGLER(RTCrKeyHasPublicPart) 3122 # define RTCrKeyRelease RT_MANGLER(RTCrKeyRelease) 3123 # define RTCrKeyRetain RT_MANGLER(RTCrKeyRetain) 3113 3124 # define RTCrRsaDigestInfo_DecodeAsn1 RT_MANGLER(RTCrRsaDigestInfo_DecodeAsn1) 3114 3125 # define RTCrRsaOtherPrimeInfo_DecodeAsn1 RT_MANGLER(RTCrRsaOtherPrimeInfo_DecodeAsn1) -
trunk/include/iprt/types.h
r73475 r73665 2087 2087 #define NIL_RTCRDIGEST (0) 2088 2088 2089 /** Cryptographic key handle. */ 2090 typedef R3R0PTRTYPE(struct RTCRKEYINT RT_FAR *) RTCRKEY; 2091 /** Pointer to a cryptographic key handle. */ 2092 typedef RTCRKEY RT_FAR *PRTCRKEY; 2093 /** Cryptographic key handle nil value. */ 2094 #define NIL_RTCRKEY (0) 2095 2089 2096 /** Public key encryption schema handle. */ 2090 2097 typedef R3R0PTRTYPE(struct RTCRPKIXENCRYPTIONINT RT_FAR *) RTCRPKIXENCRYPTION;
Note:
See TracChangeset
for help on using the changeset viewer.