Changeset 84163 in vbox for trunk/include/iprt/crypto
- Timestamp:
- May 6, 2020 3:31:33 PM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 137766
- Location:
- trunk/include/iprt/crypto
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/crypto/pem.h
r82968 r84163 31 31 32 32 #include <iprt/types.h> 33 #include <iprt/asn1.h> /* PRTASN1CORE */ 34 #include <iprt/string.h> /* PFNRTSTROUTPUT */ 33 35 34 36 … … 205 207 PCRTCRPEMMARKER paMarkers, size_t cMarkers); 206 208 209 210 /** 211 * PEM formatter for a binary data blob. 212 * 213 * @returns Number of output bytes (sum of @a pfnOutput return values). 214 * @param pfnOutput The output callback function. 215 * @param pvUser The user argument to the output callback. 216 * @param pvContent The binary blob to output. 217 * @param cbContent Size of the binary blob. 218 * @param pszMarker The PEM marker, .e.g "PRIVATE KEY", "CERTIFICATE" or 219 * similar. 220 * @sa RTCrPemWriteAsn1, RTCrPemWriteAsn1ToVfsFile, 221 * RTCrPemWriteAsn1ToVfsFile 222 */ 223 RTDECL(size_t) RTCrPemWriteBlob(PFNRTSTROUTPUT pfnOutput, void *pvUser, 224 const void *pvContent, size_t cbContent, const char *pszMarker); 225 226 /** 227 * PEM formatter for a generic ASN.1 structure. 228 * 229 * This will call both RTAsn1EncodePrepare() and RTAsn1EncodeWrite() on 230 * @a pRoot. Uses DER encoding. 231 * 232 * @returns Number of outputted chars (sum of @a pfnOutput return values), 233 * negative values are error status codes from the ASN.1 encoding. 234 * @param pfnOutput The output callback function. 235 * @param pvUser The user argument to the output callback. 236 * @param fFlags Reserved, MBZ. 237 * @param pRoot The root of the ASN.1 to encode and format as PEM. 238 * @param pszMarker The PEM marker, .e.g "PRIVATE KEY", "CERTIFICATE" or 239 * similar. 240 * @sa RTCrPemWriteAsn1ToVfsFile, RTCrPemWriteAsn1ToVfsFile, 241 * RTCrPemWriteBlob 242 */ 243 RTDECL(ssize_t) RTCrPemWriteAsn1(PFNRTSTROUTPUT pfnOutput, void *pvUser, PRTASN1CORE pRoot, 244 uint32_t fFlags, const char *pszMarker, PRTERRINFO pErrInfo); 245 246 /** 247 * PEM formatter for a generic ASN.1 structure and output it to @a hVfsIos. 248 * 249 * This will call both RTAsn1EncodePrepare() and RTAsn1EncodeWrite() on 250 * @a pRoot. Uses DER encoding. 251 * 252 * @returns Number of chars written, negative values are error status codes from 253 * the ASN.1 encoding or from RTVfsIoStrmWrite(). 254 * @param hVfsIos Handle to the I/O stream to write it to. 255 * @param fFlags Reserved, MBZ. 256 * @param pRoot The root of the ASN.1 to encode and format as PEM. 257 * @param pszMarker The PEM marker, .e.g "PRIVATE KEY", "CERTIFICATE" or 258 * similar. 259 * @sa RTCrPemWriteAsn1ToVfsFile, RTCrPemWriteAsn1, RTCrPemWriteBlob 260 */ 261 RTDECL(ssize_t) RTCrPemWriteAsn1ToVfsIoStrm(RTVFSIOSTREAM hVfsIos, PRTASN1CORE pRoot, 262 uint32_t fFlags, const char *pszMarker, PRTERRINFO pErrInfo); 263 264 /** 265 * PEM formatter for a generic ASN.1 structure and output it to @a hVfsFile. 266 * 267 * This will call both RTAsn1EncodePrepare() and RTAsn1EncodeWrite() on 268 * @a pRoot. Uses DER encoding. 269 * 270 * @returns Number of chars written, negative values are error status codes from 271 * the ASN.1 encoding or from RTVfsIoStrmWrite(). 272 * @param hVfsFile Handle to the file to write it to. 273 * @param fFlags Reserved, MBZ. 274 * @param pRoot The root of the ASN.1 to encode and format as PEM. 275 * @param pszMarker The PEM marker, .e.g "PRIVATE KEY", "CERTIFICATE" or 276 * similar. 277 * @sa RTCrPemWriteAsn1ToVfsIoStrm, RTCrPemWriteAsn1, RTCrPemWriteBlob 278 */ 279 RTDECL(ssize_t) RTCrPemWriteAsn1ToVfsFile(RTVFSFILE hVfsFile, PRTASN1CORE pRoot, 280 uint32_t fFlags, const char *pszMarker, PRTERRINFO pErrInfo); 281 207 282 /** @} */ 208 283 -
trunk/include/iprt/crypto/x509.h
r82968 r84163 1034 1034 1035 1035 1036 /** Wrapper around RTCrPemWriteAsn1ToVfsIoStrm(). */ 1037 DECLINLINE(int) RTCrX509Certificate_WriteToVfsIoStrm(RTVFSIOSTREAM hVfsIos, PRTCRX509CERTIFICATE pCertificate, PRTERRINFO pErrInfo) 1038 { 1039 return RTCrPemWriteAsn1ToVfsIoStrm(hVfsIos, &pCertificate->SeqCore.Asn1Core, 0 /*fFlags*/, 1040 g_aRTCrX509CertificateMarkers[0].paWords[0].pszWord, pErrInfo); 1041 } 1042 1043 /** Wrapper around RTCrPemWriteAsn1ToVfsFile(). */ 1044 DECLINLINE(int) RTCrX509Certificate_WriteToVfsFile(RTVFSFILE hVfsFile, PRTCRX509CERTIFICATE pCertificate, PRTERRINFO pErrInfo) 1045 { 1046 return RTCrPemWriteAsn1ToVfsFile(hVfsFile, &pCertificate->SeqCore.Asn1Core, 0 /*fFlags*/, 1047 g_aRTCrX509CertificateMarkers[0].paWords[0].pszWord, pErrInfo); 1048 } 1036 1049 1037 1050 /** @name X.509 Certificate Extensions
Note:
See TracChangeset
for help on using the changeset viewer.