本文整理汇总了C++中xmlSecTransformCheckId函数的典型用法代码示例。如果您正苦于以下问题:C++ xmlSecTransformCheckId函数的具体用法?C++ xmlSecTransformCheckId怎么用?C++ xmlSecTransformCheckId使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xmlSecTransformCheckId函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: xmlSecNssDigestCheckId
static int
xmlSecNssDigestCheckId(xmlSecTransformPtr transform) {
#ifndef XMLSEC_NO_MD5
if(xmlSecTransformCheckId(transform, xmlSecNssTransformMd5Id)) {
return(1);
}
#endif /* XMLSEC_NO_MD5 */
#ifndef XMLSEC_NO_SHA1
if(xmlSecTransformCheckId(transform, xmlSecNssTransformSha1Id)) {
return(1);
}
#endif /* XMLSEC_NO_SHA1 */
#ifndef XMLSEC_NO_SHA256
if(xmlSecTransformCheckId(transform, xmlSecNssTransformSha256Id)) {
return(1);
}
#endif /* XMLSEC_NO_SHA256 */
#ifndef XMLSEC_NO_SHA384
if(xmlSecTransformCheckId(transform, xmlSecNssTransformSha384Id)) {
return(1);
}
#endif /* XMLSEC_NO_SHA384 */
#ifndef XMLSEC_NO_SHA512
if(xmlSecTransformCheckId(transform, xmlSecNssTransformSha512Id)) {
return(1);
}
#endif /* XMLSEC_NO_SHA512 */
return(0);
}
示例2: xmlSecNssKWAesGetKeySize
static xmlSecSize
xmlSecNssKWAesGetKeySize(xmlSecTransformPtr transform) {
if(xmlSecTransformCheckId(transform, xmlSecNssTransformKWAes128Id)) {
return(XMLSEC_NSS_AES128_KEY_SIZE);
} else if(xmlSecTransformCheckId(transform, xmlSecNssTransformKWAes192Id)) {
return(XMLSEC_NSS_AES192_KEY_SIZE);
} else if(xmlSecTransformCheckId(transform, xmlSecNssTransformKWAes256Id)) {
return(XMLSEC_NSS_AES256_KEY_SIZE);
}
return(0);
}
示例3: xmlSecMSCryptoKWAesCheckId
static int
xmlSecMSCryptoKWAesCheckId(xmlSecTransformPtr transform) {
if(xmlSecTransformCheckId(transform, xmlSecMSCryptoTransformKWAes128Id) ||
xmlSecTransformCheckId(transform, xmlSecMSCryptoTransformKWAes192Id) ||
xmlSecTransformCheckId(transform, xmlSecMSCryptoTransformKWAes256Id)) {
return(1);
}
return(0);
}
示例4: xmlSecMSCngSignatureInitialize
static int xmlSecMSCngSignatureInitialize(xmlSecTransformPtr transform) {
xmlSecMSCngSignatureCtxPtr ctx;
xmlSecAssert2(xmlSecMSCngSignatureCheckId(transform), -1);
xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecMSCngSignatureSize), -1);
ctx = xmlSecMSCngSignatureGetCtx(transform);
xmlSecAssert2(ctx != NULL, -1);
memset(ctx, 0, sizeof(xmlSecMSCngSignatureCtx));
#ifndef XMLSEC_NO_ECDSA
#ifndef XMLSEC_NO_SHA256
if(xmlSecTransformCheckId(transform, xmlSecMSCngTransformEcdsaSha256Id)) {
ctx->pszHashAlgId = BCRYPT_SHA256_ALGORITHM;
ctx->keyId = xmlSecMSCngKeyDataEcdsaId;
} else
#endif /* XMLSEC_NO_SHA256 */
#endif /* XMLSEC_NO_ECDSA */
/* not found */
{
xmlSecInvalidTransfromError(transform)
return(-1);
}
return(0);
}
示例5: xmlSecTransformXPointerNodeRead
static int
xmlSecTransformXPointerNodeRead(xmlSecTransformPtr transform, xmlNodePtr node, xmlSecTransformCtxPtr transformCtx) {
xmlSecPtrListPtr dataList;
xmlSecXPathDataPtr data;
xmlNodePtr cur;
int ret;
xmlSecAssert2(xmlSecTransformCheckId(transform, xmlSecTransformXPointerId), -1);
xmlSecAssert2(node != NULL, -1);
xmlSecAssert2(transformCtx != NULL, -1);
dataList = xmlSecXPathTransformGetDataList(transform);
xmlSecAssert2(xmlSecPtrListCheckId(dataList, xmlSecXPathDataListId), -1);
xmlSecAssert2(xmlSecPtrListGetSize(dataList) == 0, -1);
/* there is only one required node */
cur = xmlSecGetNextElementNode(node->children);
if((cur == NULL) || (!xmlSecCheckNodeName(cur, xmlSecNodeXPointer, xmlSecXPointerNs))) {
xmlSecInvalidNodeError(cur, xmlSecNodeXPointer,
xmlSecTransformGetName(transform));
return(-1);
}
/* read information from the node */
data = xmlSecXPathDataCreate(xmlSecXPathDataTypeXPointer);
if(data == NULL) {
xmlSecInternalError("xmlSecXPathDataCreate",
xmlSecTransformGetName(transform));
return(-1);
}
ret = xmlSecXPathDataNodeRead(data, cur);
if(ret < 0) {
xmlSecInternalError("xmlSecXPathDataNodeRead",
xmlSecTransformGetName(transform));
xmlSecXPathDataDestroy(data);
return(-1);
}
/* append it to the list */
ret = xmlSecPtrListAdd(dataList, data);
if(ret < 0) {
xmlSecInternalError("xmlSecPtrListAdd",
xmlSecTransformGetName(transform));
xmlSecXPathDataDestroy(data);
return(-1);
}
/* set correct node set type and operation */
data->nodeSetOp = xmlSecNodeSetIntersection;
data->nodeSetType = xmlSecNodeSetTree;
/* check that we have nothing else */
cur = xmlSecGetNextElementNode(cur->next);
if(cur != NULL) {
xmlSecUnexpectedNodeError(cur, xmlSecTransformGetName(transform));
return(-1);
}
return(0);
}
示例6: xmlSecOpenSSLRsaOaepSetKey
static int
xmlSecOpenSSLRsaOaepSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
xmlSecOpenSSLRsaOaepCtxPtr ctx;
EVP_PKEY* pKey;
RSA *rsa;
xmlSecAssert2(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformRsaOaepId), -1);
xmlSecAssert2((transform->operation == xmlSecTransformOperationEncrypt) || (transform->operation == xmlSecTransformOperationDecrypt), -1);
xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecOpenSSLRsaOaepSize), -1);
xmlSecAssert2(key != NULL, -1);
xmlSecAssert2(xmlSecKeyDataCheckId(xmlSecKeyGetValue(key), xmlSecOpenSSLKeyDataRsaId), -1);
ctx = xmlSecOpenSSLRsaOaepGetCtx(transform);
xmlSecAssert2(ctx != NULL, -1);
xmlSecAssert2(ctx->pKey == NULL, -1);
pKey = xmlSecOpenSSLKeyDataRsaGetEvp(xmlSecKeyGetValue(key));
if(pKey == NULL) {
xmlSecInternalError("xmlSecOpenSSLKeyDataRsaGetEvp",
xmlSecTransformGetName(transform));
return(-1);
}
xmlSecAssert2(EVP_PKEY_base_id(pKey) == EVP_PKEY_RSA, -1);
rsa = EVP_PKEY_get0_RSA(pKey);
xmlSecAssert2(rsa != NULL, -1);
ctx->pKey = xmlSecOpenSSLEvpKeyDup(pKey);
if(ctx->pKey == NULL) {
xmlSecInternalError("xmlSecOpenSSLEvpKeyDup",
xmlSecTransformGetName(transform));
return(-1);
}
return(0);
}
示例7: xmlSecMSCryptoRsaPkcs1SetKey
static int
xmlSecMSCryptoRsaPkcs1SetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
xmlSecMSCryptoRsaPkcs1CtxPtr ctx;
xmlSecAssert2(xmlSecTransformCheckId(transform, xmlSecMSCryptoTransformRsaPkcs1Id), -1);
xmlSecAssert2((transform->operation == xmlSecTransformOperationEncrypt) || (transform->operation == xmlSecTransformOperationDecrypt), -1);
xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecMSCryptoRsaPkcs1Size), -1);
xmlSecAssert2(key != NULL, -1);
xmlSecAssert2(xmlSecKeyDataCheckId(xmlSecKeyGetValue(key), xmlSecMSCryptoKeyDataRsaId), -1);
ctx = xmlSecMSCryptoRsaPkcs1GetCtx(transform);
xmlSecAssert2(ctx != NULL, -1);
xmlSecAssert2(ctx->data == NULL, -1);
ctx->data = xmlSecKeyDataDuplicate(xmlSecKeyGetValue(key));
if(ctx->data == NULL) {
xmlSecErr_a_ignorar5(XMLSEC_ERRORS_HERE,
xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
"xmlSecKeyDataDuplicate",
XMLSEC_ERRORS_R_XMLSEC_FAILED,
XMLSEC_ERRORS_NO_MESSAGE);
return(-1);
}
return(0);
}
示例8: xmlSecGCryptKWAesInitialize
static int
xmlSecGCryptKWAesInitialize(xmlSecTransformPtr transform) {
xmlSecGCryptKWAesCtxPtr ctx;
int ret;
xmlSecAssert2(xmlSecGCryptKWAesCheckId(transform), -1);
xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecGCryptKWAesSize), -1);
ctx = xmlSecGCryptKWAesGetCtx(transform);
xmlSecAssert2(ctx != NULL, -1);
if(xmlSecTransformCheckId(transform, xmlSecGCryptTransformKWAes128Id)) {
ctx->cipher = GCRY_CIPHER_AES128;
ctx->keyExpectedSize = XMLSEC_KW_AES128_KEY_SIZE;
} else if(xmlSecTransformCheckId(transform, xmlSecGCryptTransformKWAes192Id)) {
ctx->cipher = GCRY_CIPHER_AES192;
ctx->keyExpectedSize = XMLSEC_KW_AES192_KEY_SIZE;
} else if(xmlSecTransformCheckId(transform, xmlSecGCryptTransformKWAes256Id)) {
ctx->cipher = GCRY_CIPHER_AES256;
ctx->keyExpectedSize = XMLSEC_KW_AES256_KEY_SIZE;
} else {
xmlSecError(XMLSEC_ERRORS_HERE,
xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
NULL,
XMLSEC_ERRORS_R_INVALID_TRANSFORM,
XMLSEC_ERRORS_NO_MESSAGE);
return(-1);
}
ctx->mode = GCRY_CIPHER_MODE_CBC;
ctx->flags = GCRY_CIPHER_SECURE; /* we are paranoid */
ctx->blockSize = gcry_cipher_get_algo_blklen(ctx->cipher);
xmlSecAssert2(ctx->blockSize > 0, -1);
ret = xmlSecBufferInitialize(&(ctx->keyBuffer), 0);
if(ret < 0) {
xmlSecError(XMLSEC_ERRORS_HERE,
xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
"xmlSecGCryptKWAesGetKey",
XMLSEC_ERRORS_R_XMLSEC_FAILED,
XMLSEC_ERRORS_NO_MESSAGE);
return(-1);
}
return(0);
}
示例9: xmlSecOpenSSLRsaOaepNodeRead
static int
xmlSecOpenSSLRsaOaepNodeRead(xmlSecTransformPtr transform, xmlNodePtr node, xmlSecTransformCtxPtr transformCtx) {
xmlSecOpenSSLRsaOaepCtxPtr ctx;
xmlNodePtr cur;
int ret;
xmlSecAssert2(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformRsaOaepId), -1);
xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecOpenSSLRsaOaepSize), -1);
xmlSecAssert2(node != NULL, -1);
xmlSecAssert2(transformCtx != NULL, -1);
ctx = xmlSecOpenSSLRsaOaepGetCtx(transform);
xmlSecAssert2(ctx != NULL, -1);
xmlSecAssert2(xmlSecBufferGetSize(&(ctx->oaepParams)) == 0, -1);
cur = xmlSecGetNextElementNode(node->children);
while(cur != NULL) {
if(xmlSecCheckNodeName(cur, xmlSecNodeRsaOAEPparams, xmlSecEncNs)) {
ret = xmlSecBufferBase64NodeContentRead(&(ctx->oaepParams), cur);
if(ret < 0) {
xmlSecInternalError("xmlSecBufferBase64NodeContentRead",
xmlSecTransformGetName(transform));
return(-1);
}
} else if(xmlSecCheckNodeName(cur, xmlSecNodeDigestMethod, xmlSecDSigNs)) {
xmlChar* algorithm;
/* Algorithm attribute is required */
algorithm = xmlGetProp(cur, xmlSecAttrAlgorithm);
if(algorithm == NULL) {
xmlSecInvalidNodeAttributeError(cur, xmlSecAttrAlgorithm,
xmlSecTransformGetName(transform),
"empty");
return(-1);
}
/* for now we support only sha1 */
if(xmlStrcmp(algorithm, xmlSecHrefSha1) != 0) {
xmlSecInvalidTransfromError2(transform,
"digest algorithm=\"%s\" is not supported for rsa/oaep",
xmlSecErrorsSafeString(algorithm));
xmlFree(algorithm);
return(-1);
}
xmlFree(algorithm);
} else {
/* not found */
xmlSecUnexpectedNodeError(cur, xmlSecTransformGetName(transform));
return(-1);
}
/* next node */
cur = xmlSecGetNextElementNode(cur->next);
}
return(0);
}
示例10: xmlSecTransformXPointerSetExpr
/**
* xmlSecTransformXPointerSetExpr:
* @transform: the pointer to XPointer transform.
* @expr: the XPointer expression.
* @nodeSetType: the type of evaluated XPointer expression.
* @hereNode: the pointer to "here" node.
*
* Sets the XPointer expression for an XPointer @transform.
*
* Returns: 0 on success or a negative value if an error occurs.
*/
int
xmlSecTransformXPointerSetExpr(xmlSecTransformPtr transform, const xmlChar* expr,
xmlSecNodeSetType nodeSetType, xmlNodePtr hereNode) {
xmlSecPtrListPtr dataList;
xmlSecXPathDataPtr data;
int ret;
xmlSecAssert2(xmlSecTransformCheckId(transform, xmlSecTransformXPointerId), -1);
xmlSecAssert2(transform->hereNode == NULL, -1);
xmlSecAssert2(expr != NULL, -1);
xmlSecAssert2(hereNode != NULL, -1);
transform->hereNode = hereNode;
dataList = xmlSecXPathTransformGetDataList(transform);
xmlSecAssert2(xmlSecPtrListCheckId(dataList, xmlSecXPathDataListId), -1);
xmlSecAssert2(xmlSecPtrListGetSize(dataList) == 0, -1);
data = xmlSecXPathDataCreate(xmlSecXPathDataTypeXPointer);
if(data == NULL) {
xmlSecInternalError("xmlSecXPathDataCreate",
xmlSecTransformGetName(transform));
return(-1);
}
ret = xmlSecXPathDataRegisterNamespaces(data, hereNode);
if(ret < 0) {
xmlSecInternalError("xmlSecXPathDataRegisterNamespaces",
xmlSecTransformGetName(transform));
xmlSecXPathDataDestroy(data);
return(-1);
}
ret = xmlSecXPathDataSetExpr(data, expr);
if(ret < 0) {
xmlSecInternalError("xmlSecXPathDataSetExpr",
xmlSecTransformGetName(transform));
xmlSecXPathDataDestroy(data);
return(-1);
}
/* append it to the list */
ret = xmlSecPtrListAdd(dataList, data);
if(ret < 0) {
xmlSecInternalError("xmlSecPtrListAdd",
xmlSecTransformGetName(transform));
xmlSecXPathDataDestroy(data);
return(-1);
}
/* set correct node set type and operation */
data->nodeSetOp = xmlSecNodeSetIntersection;
data->nodeSetType = nodeSetType;
return(0);
}
示例11: xmlSecTransformBase64SetLineSize
/**
* xmlSecTransformBase64SetLineSize:
* @transform: the pointer to BASE64 encode transform.
* @lineSize: the new max line size.
*
* Sets the max line size to @lineSize.
*/
void
xmlSecTransformBase64SetLineSize(xmlSecTransformPtr transform, xmlSecSize lineSize) {
xmlSecBase64CtxPtr ctx;
xmlSecAssert(xmlSecTransformCheckId(transform, xmlSecTransformBase64Id));
ctx = xmlSecBase64GetCtx(transform);
xmlSecAssert(ctx != NULL);
ctx->columns = lineSize;
}
示例12: xmlSecTransformMemBufFinalize
static void
xmlSecTransformMemBufFinalize(xmlSecTransformPtr transform) {
xmlSecBufferPtr buffer;
xmlSecAssert(xmlSecTransformCheckId(transform, xmlSecTransformMemBufId));
buffer = xmlSecTransformMemBufGetBuf(transform);
xmlSecAssert(buffer != NULL);
xmlSecBufferFinalize(xmlSecTransformMemBufGetBuf(transform));
}
示例13: xmlSecBase64Finalize
static void
xmlSecBase64Finalize(xmlSecTransformPtr transform) {
xmlSecBase64CtxPtr ctx;
xmlSecAssert(xmlSecTransformCheckId(transform, xmlSecTransformBase64Id));
ctx = xmlSecBase64GetCtx(transform);
xmlSecAssert(ctx != NULL);
xmlSecBase64CtxFinalize(ctx);
}
示例14: xmlSecTransformMemBufGetBuffer
/**
* xmlSecTransformMemBufGetBuffer:
* @transform: the pointer to memory buffer transform.
*
* Gets the pointer to memory buffer transform buffer.
*
* Returns: pointer to the transform's #xmlSecBuffer.
*/
xmlSecBufferPtr
xmlSecTransformMemBufGetBuffer(xmlSecTransformPtr transform) {
xmlSecBufferPtr buffer;
xmlSecAssert2(xmlSecTransformCheckId(transform, xmlSecTransformMemBufId), NULL);
buffer = xmlSecTransformMemBufGetBuf(transform);
xmlSecAssert2(buffer != NULL, NULL);
return(buffer);
}
示例15: xmlSecGCryptKWDes3Finalize
static void
xmlSecGCryptKWDes3Finalize(xmlSecTransformPtr transform) {
xmlSecGCryptKWDes3CtxPtr ctx;
xmlSecAssert(xmlSecTransformCheckId(transform, xmlSecGCryptTransformKWDes3Id));
xmlSecAssert(xmlSecTransformCheckSize(transform, xmlSecGCryptKWDes3Size));
ctx = xmlSecGCryptKWDes3GetCtx(transform);
xmlSecAssert(ctx != NULL);
xmlSecBufferFinalize(&(ctx->keyBuffer));
}