/usr/include/xmlsec1/xmlsec/transforms.h is in libxmlsec1-dev 1.2.18-2ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 | /**
* XML Security Library (http://www.aleksey.com/xmlsec).
*
* The transforms engine
*
* This is free software; see Copyright file in the source
* distribution for preciese wording.
*
* Copyright (C) 2002-2003 Aleksey Sanin <aleksey@aleksey.com>
*/
#ifndef __XMLSEC_TRANSFORMS_H__
#define __XMLSEC_TRANSFORMS_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <libxml/tree.h>
#include <libxml/xpath.h>
#include <xmlsec/xmlsec.h>
#include <xmlsec/buffer.h>
#include <xmlsec/list.h>
#include <xmlsec/nodeset.h>
#include <xmlsec/keys.h>
typedef const struct _xmlSecTransformKlass xmlSecTransformKlass,
*xmlSecTransformId;
/**
* XMLSEC_TRANSFORM_BINARY_CHUNK:
*
* The binary data chunks size. XMLSec processes binary data one chunk
* at a time. Changing this impacts xmlsec memory usage and performance.
*/
#define XMLSEC_TRANSFORM_BINARY_CHUNK 64
/**********************************************************************
*
* High-level functions
*
*********************************************************************/
XMLSEC_EXPORT xmlSecPtrListPtr xmlSecTransformIdsGet (void);
XMLSEC_EXPORT int xmlSecTransformIdsInit (void);
XMLSEC_EXPORT void xmlSecTransformIdsShutdown (void);
XMLSEC_EXPORT int xmlSecTransformIdsRegisterDefault(void);
XMLSEC_EXPORT int xmlSecTransformIdsRegister (xmlSecTransformId id);
/**
* xmlSecTransformStatus:
* @xmlSecTransformStatusNone: the status unknown.
* @xmlSecTransformStatusWorking: the transform is executed.
* @xmlSecTransformStatusFinished: the transform finished
* @xmlSecTransformStatusOk: the transform succeeded.
* @xmlSecTransformStatusFail: the transform failed (an error occur).
*
* The transform execution status.
*/
typedef enum {
xmlSecTransformStatusNone = 0,
xmlSecTransformStatusWorking,
xmlSecTransformStatusFinished,
xmlSecTransformStatusOk,
xmlSecTransformStatusFail
} xmlSecTransformStatus;
/**
* xmlSecTransformMode:
* @xmlSecTransformModeNone: the mode is unknown.
* @xmlSecTransformModePush: pushing data thru transform.
* @xmlSecTransformModePop: popping data from transform.
*
* The transform operation mode
*/
typedef enum {
xmlSecTransformModeNone = 0,
xmlSecTransformModePush,
xmlSecTransformModePop
} xmlSecTransformMode;
/**
* xmlSecTransformOperation:
* @xmlSecTransformOperationNone: the operation is unknown.
* @xmlSecTransformOperationEncode: the encode operation (for base64 transform).
* @xmlSecTransformOperationDecode: the decode operation (for base64 transform).
* @xmlSecTransformOperationSign: the sign or digest operation.
* @xmlSecTransformOperationVerify: the verification of signature or digest operation.
* @xmlSecTransformOperationEncrypt: the encryption operation.
* @xmlSecTransformOperationDecrypt: the decryption operation.
*
* The transform operation.
*/
typedef enum {
xmlSecTransformOperationNone = 0,
xmlSecTransformOperationEncode,
xmlSecTransformOperationDecode,
xmlSecTransformOperationSign,
xmlSecTransformOperationVerify,
xmlSecTransformOperationEncrypt,
xmlSecTransformOperationDecrypt
} xmlSecTransformOperation;
/**************************************************************************
*
* xmlSecTransformUriType:
*
*************************************************************************/
/**
* xmlSecTransformUriType:
*
* URI transform type bit mask.
*/
typedef unsigned int xmlSecTransformUriType;
/**
* xmlSecTransformUriTypeNone:
*
* The URI type is unknown or not set.
*/
#define xmlSecTransformUriTypeNone 0x0000
/**
* xmlSecTransformUriTypeEmpty:
*
* The empty URI ("") type.
*/
#define xmlSecTransformUriTypeEmpty 0x0001
/**
* xmlSecTransformUriTypeSameDocument:
*
* The smae document ("#...") but not empty ("") URI type.
*/
#define xmlSecTransformUriTypeSameDocument 0x0002
/**
* xmlSecTransformUriTypeLocal:
*
* The local URI ("file:///....") type.
*/
#define xmlSecTransformUriTypeLocal 0x0004
/**
* xmlSecTransformUriTypeRemote:
*
* The remote URI type.
*/
#define xmlSecTransformUriTypeRemote 0x0008
/**
* xmlSecTransformUriTypeAny:
*
* Any URI type.
*/
#define xmlSecTransformUriTypeAny 0xFFFF
XMLSEC_EXPORT int xmlSecTransformUriTypeCheck (xmlSecTransformUriType type,
const xmlChar* uri);
/**************************************************************************
*
* xmlSecTransformDataType
*
*************************************************************************/
/**
* xmlSecTransformDataType:
*
* Transform data type bit mask.
*/
typedef xmlSecByte xmlSecTransformDataType;
/**
* xmlSecTransformDataTypeUnknown:
*
* The transform data type is unknown or nor data expected.
*/
#define xmlSecTransformDataTypeUnknown 0x0000
/**
* xmlSecTransformDataTypeBin:
*
* The binary transform data.
*/
#define xmlSecTransformDataTypeBin 0x0001
/**
* xmlSecTransformDataTypeXml:
*
* The xml transform data.
*/
#define xmlSecTransformDataTypeXml 0x0002
/**************************************************************************
*
* xmlSecTransformUsage
*
*************************************************************************/
/**
* xmlSecTransformUsage:
*
* The transform usage bit mask.
*/
typedef unsigned int xmlSecTransformUsage;
/**
* xmlSecTransformUsageUnknown:
*
* Transforms usage is unknown or undefined.
*/
#define xmlSecTransformUsageUnknown 0x0000
/**
* xmlSecTransformUsageDSigTransform:
*
* Transform could be used in <dsig:Transform>.
*/
#define xmlSecTransformUsageDSigTransform 0x0001
/**
* xmlSecTransformUsageC14NMethod:
*
* Transform could be used in <dsig:CanonicalizationMethod>.
*/
#define xmlSecTransformUsageC14NMethod 0x0002
/**
* xmlSecTransformUsageDigestMethod:
*
* Transform could be used in <dsig:DigestMethod>.
*/
#define xmlSecTransformUsageDigestMethod 0x0004
/**
* xmlSecTransformUsageSignatureMethod:
*
* Transform could be used in <dsig:SignatureMethod>.
*/
#define xmlSecTransformUsageSignatureMethod 0x0008
/**
* xmlSecTransformUsageEncryptionMethod:
*
* Transform could be used in <enc:EncryptionMethod>.
*/
#define xmlSecTransformUsageEncryptionMethod 0x0010
/**
* xmlSecTransformUsageAny:
*
* Transform could be used for operation.
*/
#define xmlSecTransformUsageAny 0xFFFF
/**************************************************************************
*
* xmlSecTransformCtx
*
*************************************************************************/
/**
* xmlSecTransformCtxPreExecuteCallback:
* @transformCtx: the pointer to transform's context.
*
* The callback called after creating transforms chain but before
* starting data processing. Application can use this callback to
* do additional transforms chain verification or modification and
* aborting transforms execution (if necessary).
*
* Returns: 0 on success and a negative value otherwise (in this case,
* transforms chain will not be executed and xmlsec processing stops).
*/
typedef int (*xmlSecTransformCtxPreExecuteCallback) (xmlSecTransformCtxPtr transformCtx);
/**
* XMLSEC_TRANSFORMCTX_FLAGS_USE_VISA3D_HACK:
*
* If this flag is set then URI ID references are resolved directly
* without using XPointers. This allows one to sign/verify Visa3D
* documents that don't follow XML, XPointer and XML DSig specifications.
*/
#define XMLSEC_TRANSFORMCTX_FLAGS_USE_VISA3D_HACK 0x00000001
/**
* xmlSecTransformCtx:
* @userData: the pointer to user data (xmlsec and xmlsec-crypto never
* touch this).
* @flags: the bit mask flags to control transforms execution
* (reserved for the future).
* @flags2: the bit mask flags to control transforms execution
* (reserved for the future).
* @enabledUris: the allowed transform data source uri types.
* @enabledTransforms: the list of enabled transforms; if list is empty (default)
* then all registered transforms are enabled.
* @preExecCallback: the callback called after preparing transform chain
* and right before actual data processing; application
* can use this callback to change transforms parameters,
* insert additional transforms in the chain or do
* additional validation (and abort transform execution
* if needed).
* @result: the pointer to transforms result buffer.
* @status: the transforms chain processng status.
* @uri: the data source URI without xpointer expression.
* @xptrExpr: the xpointer expression from data source URI (if any).
* @first: the first transform in the chain.
* @last: the last transform in the chain.
* @reserved0: reserved for the future.
* @reserved1: reserved for the future.
*
* The transform execution context.
*/
struct _xmlSecTransformCtx {
/* user settings */
void* userData;
unsigned int flags;
unsigned int flags2;
xmlSecTransformUriType enabledUris;
xmlSecPtrList enabledTransforms;
xmlSecTransformCtxPreExecuteCallback preExecCallback;
/* results */
xmlSecBufferPtr result;
xmlSecTransformStatus status;
xmlChar* uri;
xmlChar* xptrExpr;
xmlSecTransformPtr first;
xmlSecTransformPtr last;
/* for the future */
void* reserved0;
void* reserved1;
};
XMLSEC_EXPORT xmlSecTransformCtxPtr xmlSecTransformCtxCreate (void);
XMLSEC_EXPORT void xmlSecTransformCtxDestroy (xmlSecTransformCtxPtr ctx);
XMLSEC_EXPORT int xmlSecTransformCtxInitialize (xmlSecTransformCtxPtr ctx);
XMLSEC_EXPORT void xmlSecTransformCtxFinalize (xmlSecTransformCtxPtr ctx);
XMLSEC_EXPORT void xmlSecTransformCtxReset (xmlSecTransformCtxPtr ctx);
XMLSEC_EXPORT int xmlSecTransformCtxCopyUserPref (xmlSecTransformCtxPtr dst,
xmlSecTransformCtxPtr src);
XMLSEC_EXPORT int xmlSecTransformCtxSetUri (xmlSecTransformCtxPtr ctx,
const xmlChar* uri,
xmlNodePtr hereNode);
XMLSEC_EXPORT int xmlSecTransformCtxAppend (xmlSecTransformCtxPtr ctx,
xmlSecTransformPtr transform);
XMLSEC_EXPORT int xmlSecTransformCtxPrepend (xmlSecTransformCtxPtr ctx,
xmlSecTransformPtr transform);
XMLSEC_EXPORT xmlSecTransformPtr xmlSecTransformCtxCreateAndAppend(xmlSecTransformCtxPtr ctx,
xmlSecTransformId id);
XMLSEC_EXPORT xmlSecTransformPtr xmlSecTransformCtxCreateAndPrepend(xmlSecTransformCtxPtr ctx,
xmlSecTransformId id);
XMLSEC_EXPORT xmlSecTransformPtr xmlSecTransformCtxNodeRead (xmlSecTransformCtxPtr ctx,
xmlNodePtr node,
xmlSecTransformUsage usage);
XMLSEC_EXPORT int xmlSecTransformCtxNodesListRead (xmlSecTransformCtxPtr ctx,
xmlNodePtr node,
xmlSecTransformUsage usage);
XMLSEC_EXPORT int xmlSecTransformCtxPrepare (xmlSecTransformCtxPtr ctx,
xmlSecTransformDataType inputDataType);
XMLSEC_EXPORT int xmlSecTransformCtxBinaryExecute (xmlSecTransformCtxPtr ctx,
const xmlSecByte* data,
xmlSecSize dataSize);
XMLSEC_EXPORT int xmlSecTransformCtxUriExecute (xmlSecTransformCtxPtr ctx,
const xmlChar* uri);
XMLSEC_EXPORT int xmlSecTransformCtxXmlExecute (xmlSecTransformCtxPtr ctx,
xmlSecNodeSetPtr nodes);
XMLSEC_EXPORT int xmlSecTransformCtxExecute (xmlSecTransformCtxPtr ctx,
xmlDocPtr doc);
XMLSEC_EXPORT void xmlSecTransformCtxDebugDump (xmlSecTransformCtxPtr ctx,
FILE* output);
XMLSEC_EXPORT void xmlSecTransformCtxDebugXmlDump (xmlSecTransformCtxPtr ctx,
FILE* output);
/**************************************************************************
*
* xmlSecTransform
*
*************************************************************************/
/**
* xmlSecTransform:
* @id: the transform id (pointer to #xmlSecTransformId).
* @operation: the transform's opertaion.
* @status: the current status.
* @hereNode: the pointer to transform's <dsig:Transform /> node.
* @next: the pointer to next transform in the chain.
* @prev: the pointer to previous transform in the chain.
* @inBuf: the input binary data buffer.
* @outBuf: the output binary data buffer.
* @inNodes: the input XML nodes.
* @outNodes: the output XML nodes.
* @reserved0: reserved for the future.
* @reserved1: reserved for the future.
*
* The transform structure.
*/
struct _xmlSecTransform {
xmlSecTransformId id;
xmlSecTransformOperation operation;
xmlSecTransformStatus status;
xmlNodePtr hereNode;
/* transforms chain */
xmlSecTransformPtr next;
xmlSecTransformPtr prev;
/* binary data */
xmlSecBuffer inBuf;
xmlSecBuffer outBuf;
/* xml data */
xmlSecNodeSetPtr inNodes;
xmlSecNodeSetPtr outNodes;
/* reserved for the future */
void* reserved0;
void* reserved1;
};
XMLSEC_EXPORT xmlSecTransformPtr xmlSecTransformCreate (xmlSecTransformId id);
XMLSEC_EXPORT void xmlSecTransformDestroy (xmlSecTransformPtr transform);
XMLSEC_EXPORT xmlSecTransformPtr xmlSecTransformNodeRead (xmlNodePtr node,
xmlSecTransformUsage usage,
xmlSecTransformCtxPtr transformCtx);
XMLSEC_EXPORT int xmlSecTransformPump (xmlSecTransformPtr left,
xmlSecTransformPtr right,
xmlSecTransformCtxPtr transformCtx);
XMLSEC_EXPORT int xmlSecTransformSetKey (xmlSecTransformPtr transform,
xmlSecKeyPtr key);
XMLSEC_EXPORT int xmlSecTransformSetKeyReq(xmlSecTransformPtr transform,
xmlSecKeyReqPtr keyReq);
XMLSEC_EXPORT int xmlSecTransformVerify (xmlSecTransformPtr transform,
const xmlSecByte* data,
xmlSecSize dataSize,
xmlSecTransformCtxPtr transformCtx);
XMLSEC_EXPORT int xmlSecTransformVerifyNodeContent(xmlSecTransformPtr transform,
xmlNodePtr node,
xmlSecTransformCtxPtr transformCtx);
XMLSEC_EXPORT xmlSecTransformDataType xmlSecTransformGetDataType(xmlSecTransformPtr transform,
xmlSecTransformMode mode,
xmlSecTransformCtxPtr transformCtx);
XMLSEC_EXPORT int xmlSecTransformPushBin (xmlSecTransformPtr transform,
const xmlSecByte* data,
xmlSecSize dataSize,
int final,
xmlSecTransformCtxPtr transformCtx);
XMLSEC_EXPORT int xmlSecTransformPopBin (xmlSecTransformPtr transform,
xmlSecByte* data,
xmlSecSize maxDataSize,
xmlSecSize* dataSize,
xmlSecTransformCtxPtr transformCtx);
XMLSEC_EXPORT int xmlSecTransformPushXml (xmlSecTransformPtr transform,
xmlSecNodeSetPtr nodes,
xmlSecTransformCtxPtr transformCtx);
XMLSEC_EXPORT int xmlSecTransformPopXml (xmlSecTransformPtr transform,
xmlSecNodeSetPtr* nodes,
xmlSecTransformCtxPtr transformCtx);
XMLSEC_EXPORT int xmlSecTransformExecute (xmlSecTransformPtr transform,
int last,
xmlSecTransformCtxPtr transformCtx);
XMLSEC_EXPORT void xmlSecTransformDebugDump(xmlSecTransformPtr transform,
FILE* output);
XMLSEC_EXPORT void xmlSecTransformDebugXmlDump(xmlSecTransformPtr transform,
FILE* output);
/**
* xmlSecTransformGetName:
* @transform: the pointer to transform.
*
* Macro. Returns transform name.
*/
#define xmlSecTransformGetName(transform) \
((xmlSecTransformIsValid((transform))) ? \
xmlSecTransformKlassGetName((transform)->id) : NULL)
/**
* xmlSecTransformIsValid:
* @transform: the pointer to transform.
*
* Macro. Returns 1 if the @transform is valid or 0 otherwise.
*/
#define xmlSecTransformIsValid(transform) \
((( transform ) != NULL) && \
(( transform )->id != NULL) && \
(( transform )->id->klassSize >= sizeof(xmlSecTransformKlass)) && \
(( transform )->id->objSize >= sizeof(xmlSecTransform)) && \
(( transform )->id->name != NULL))
/**
* xmlSecTransformCheckId:
* @transform: the pointer to transform.
* @i: the transform id.
*
* Macro. Returns 1 if the @transform is valid and has specified id @i
* or 0 otherwise.
*/
#define xmlSecTransformCheckId(transform, i) \
(xmlSecTransformIsValid(( transform )) && \
((((const xmlSecTransformId) (( transform )->id))) == ( i )))
/**
* xmlSecTransformCheckSize:
* @transform: the pointer to transform.
* @size: the transform object size.
*
* Macro. Returns 1 if the @transform is valid and has at least @size
* bytes or 0 otherwise.
*/
#define xmlSecTransformCheckSize(transform, size) \
(xmlSecTransformIsValid(( transform )) && \
((( transform )->id->objSize) >= ( size )))
/************************************************************************
*
* Operations on transforms chain
*
************************************************************************/
XMLSEC_EXPORT int xmlSecTransformConnect (xmlSecTransformPtr left,
xmlSecTransformPtr right,
xmlSecTransformCtxPtr transformCtx);
XMLSEC_EXPORT void xmlSecTransformRemove (xmlSecTransformPtr transform);
/************************************************************************
*
* Default callbacks, most of the transforms can use them
*
************************************************************************/
XMLSEC_EXPORT xmlSecTransformDataType xmlSecTransformDefaultGetDataType(xmlSecTransformPtr transform,
xmlSecTransformMode mode,
xmlSecTransformCtxPtr transformCtx);
XMLSEC_EXPORT int xmlSecTransformDefaultPushBin(xmlSecTransformPtr transform,
const xmlSecByte* data,
xmlSecSize dataSize,
int final,
xmlSecTransformCtxPtr transformCtx);
XMLSEC_EXPORT int xmlSecTransformDefaultPopBin(xmlSecTransformPtr transform,
xmlSecByte* data,
xmlSecSize maxDataSize,
xmlSecSize* dataSize,
xmlSecTransformCtxPtr transformCtx);
XMLSEC_EXPORT int xmlSecTransformDefaultPushXml(xmlSecTransformPtr transform,
xmlSecNodeSetPtr nodes,
xmlSecTransformCtxPtr transformCtx);
XMLSEC_EXPORT int xmlSecTransformDefaultPopXml(xmlSecTransformPtr transform,
xmlSecNodeSetPtr* nodes,
xmlSecTransformCtxPtr transformCtx);
/************************************************************************
*
* IO buffers for transforms
*
************************************************************************/
XMLSEC_EXPORT xmlOutputBufferPtr xmlSecTransformCreateOutputBuffer(xmlSecTransformPtr transform,
xmlSecTransformCtxPtr transformCtx);
XMLSEC_EXPORT xmlParserInputBufferPtr xmlSecTransformCreateInputBuffer(xmlSecTransformPtr transform,
xmlSecTransformCtxPtr transformCtx);
/************************************************************************
*
* Transform Klass
*
************************************************************************/
/**
* xmlSecTransformInitializeMethod:
* @transform: the pointer to transform object.
*
* The transform specific initialization method.
*
* Returns: 0 on success or a negative value otherwise.
*/
typedef int (*xmlSecTransformInitializeMethod) (xmlSecTransformPtr transform);
/**
* xmlSecTransformFinalizeMethod:
* @transform: the pointer to transform object.
*
* The transform specific destroy method.
*/
typedef void (*xmlSecTransformFinalizeMethod) (xmlSecTransformPtr transform);
/**
* xmlSecTransformGetDataTypeMethod:
* @transform: the pointer to transform object.
* @mode: the mode.
* @transformCtx: the pointer to transform context object.
*
* The transform specific method to query information about transform
* data type in specified mode @mode.
*
* Returns: transform data type.
*/
typedef xmlSecTransformDataType (*xmlSecTransformGetDataTypeMethod)(xmlSecTransformPtr transform,
xmlSecTransformMode mode,
xmlSecTransformCtxPtr transformCtx);
/**
* xmlSecTransformNodeReadMethod:
* @transform: the pointer to transform object.
* @node: the pointer to <dsig:Transform/> node.
* @transformCtx: the pointer to transform context object.
*
* The transform specific method to read the transform data from
* the @node.
*
* Returns: 0 on success or a negative value otherwise.
*/
typedef int (*xmlSecTransformNodeReadMethod) (xmlSecTransformPtr transform,
xmlNodePtr node,
xmlSecTransformCtxPtr transformCtx);
/**
* xmlSecTransformNodeWriteMethod:
* @transform: the pointer to transform object.
* @node: the pointer to <dsig:Transform/> node.
* @transformCtx: the pointer to transform context object.
*
* The transform specific method to write transform information to an XML node @node.
*
* Returns: 0 on success or a negative value otherwise.
*/
typedef int (*xmlSecTransformNodeWriteMethod) (xmlSecTransformPtr transform,
xmlNodePtr node,
xmlSecTransformCtxPtr transformCtx);
/**
* xmlSecTransformSetKeyRequirementsMethod:
* @transform: the pointer to transform object.
* @keyReq: the pointer to key requirements structure.
*
* Transform specific method to set transform's key requirements.
*
* Returns: 0 on success or a negative value otherwise.
*/
typedef int (*xmlSecTransformSetKeyRequirementsMethod)(xmlSecTransformPtr transform,
xmlSecKeyReqPtr keyReq);
/**
* xmlSecTransformSetKeyMethod:
* @transform: the pointer to transform object.
* @key: the pointer to key.
*
* The transform specific method to set the key for use.
*
* Returns: 0 on success or a negative value otherwise.
*/
typedef int (*xmlSecTransformSetKeyMethod) (xmlSecTransformPtr transform,
xmlSecKeyPtr key);
/**
* xmlSecTransformVerifyMethod:
* @transform: the pointer to transform object.
* @data: the input buffer.
* @dataSize: the size of input buffer @data.
* @transformCtx: the pointer to transform context object.
*
* The transform specific method to verify transform processing results
* (used by digest and signature transforms). This method sets @status
* member of the #xmlSecTransform structure to either #xmlSecTransformStatusOk
* if verification succeeded or #xmlSecTransformStatusFail otherwise.
*
* Returns: 0 on success or a negative value otherwise.
*/
typedef int (*xmlSecTransformVerifyMethod) (xmlSecTransformPtr transform,
const xmlSecByte* data,
xmlSecSize dataSize,
xmlSecTransformCtxPtr transformCtx);
/**
* xmlSecTransformPushBinMethod:
* @transform: the pointer to transform object.
* @data: the input binary data,
* @dataSize: the input data size.
* @final: the flag: if set to 1 then it's the last
* data chunk.
* @transformCtx: the pointer to transform context object.
*
* The transform specific method to process data from @data and push
* result to the next transform in the chain.
*
* Returns: 0 on success or a negative value otherwise.
*/
typedef int (*xmlSecTransformPushBinMethod) (xmlSecTransformPtr transform,
const xmlSecByte* data,
xmlSecSize dataSize,
int final,
xmlSecTransformCtxPtr transformCtx);
/**
* xmlSecTransformPopBinMethod:
* @transform: the pointer to transform object.
* @data: the buffer to store result data.
* @maxDataSize: the size of the buffer @data.
* @dataSize: the pointer to returned data size.
* @transformCtx: the pointer to transform context object.
*
* The transform specific method to pop data from previous transform
* in the chain and return result in the @data buffer. The size of returned
* data is placed in the @dataSize.
*
* Returns: 0 on success or a negative value otherwise.
*/
typedef int (*xmlSecTransformPopBinMethod) (xmlSecTransformPtr transform,
xmlSecByte* data,
xmlSecSize maxDataSize,
xmlSecSize* dataSize,
xmlSecTransformCtxPtr transformCtx);
/**
* xmlSecTransformPushXmlMethod:
* @transform: the pointer to transform object.
* @nodes: the input nodes.
* @transformCtx: the pointer to transform context object.
*
* The transform specific method to process @nodes and push result to the next
* transform in the chain.
*
* Returns: 0 on success or a negative value otherwise.
*/
typedef int (*xmlSecTransformPushXmlMethod) (xmlSecTransformPtr transform,
xmlSecNodeSetPtr nodes,
xmlSecTransformCtxPtr transformCtx);
/**
* xmlSecTransformPopXmlMethod:
* @transform: the pointer to transform object.
* @nodes: the pointer to store popinter to result nodes.
* @transformCtx: the pointer to transform context object.
*
* The transform specific method to pop data from previous transform in the chain,
* process the data and return result in @nodes.
*
* Returns: 0 on success or a negative value otherwise.
*/
typedef int (*xmlSecTransformPopXmlMethod) (xmlSecTransformPtr transform,
xmlSecNodeSetPtr* nodes,
xmlSecTransformCtxPtr transformCtx);
/**
* xmlSecTransformExecuteMethod:
* @transform: the pointer to transform object.
* @last: the flag: if set to 1 then it's the last data chunk.
* @transformCtx: the pointer to transform context object.
*
* Transform specific method to process a chunk of data.
*
* Returns: 0 on success or a negative value otherwise.
*/
typedef int (*xmlSecTransformExecuteMethod) (xmlSecTransformPtr transform,
int last,
xmlSecTransformCtxPtr transformCtx);
/**
* xmlSecTransformKlass:
* @klassSize: the transform klass structure size.
* @objSize: the transform object size.
* @name: the transform's name.
* @href: the transform's identification string (href).
* @usage: the allowed transforms usages.
* @initialize: the initialization method.
* @finalize: the finmalization (destroy) function.
* @readNode: the XML node read method.
* @writeNode: the XML node write method.
* @setKeyReq: the set key requirements method.
* @setKey: the set key method.
* @verify: the verify method (for digest and signature transforms).
* @getDataType: the input/output data type query method.
* @pushBin: the binary data "push thru chain" processing method.
* @popBin: the binary data "pop from chain" procesing method.
* @pushXml: the XML data "push thru chain" processing method.
* @popXml: the XML data "pop from chain" procesing method.
* @execute: the low level data processing method used by default
* implementations of @pushBin, @popBin, @pushXml and @popXml.
* @reserved0: reserved for the future.
* @reserved1: reserved for the future.
*
* The transform klass desccription structure.
*/
struct _xmlSecTransformKlass {
/* data */
xmlSecSize klassSize;
xmlSecSize objSize;
const xmlChar* name;
const xmlChar* href;
xmlSecTransformUsage usage;
/* methods */
xmlSecTransformInitializeMethod initialize;
xmlSecTransformFinalizeMethod finalize;
xmlSecTransformNodeReadMethod readNode;
xmlSecTransformNodeWriteMethod writeNode;
xmlSecTransformSetKeyRequirementsMethod setKeyReq;
xmlSecTransformSetKeyMethod setKey;
xmlSecTransformVerifyMethod verify;
xmlSecTransformGetDataTypeMethod getDataType;
xmlSecTransformPushBinMethod pushBin;
xmlSecTransformPopBinMethod popBin;
xmlSecTransformPushXmlMethod pushXml;
xmlSecTransformPopXmlMethod popXml;
/* low level method */
xmlSecTransformExecuteMethod execute;
/* reserved for future */
void* reserved0;
void* reserved1;
};
/**
* xmlSecTransformKlassGetName:
* @klass: the transofrm's klass.
*
* Macro. Returns transform klass name.
*/
#define xmlSecTransformKlassGetName(klass) \
(((klass)) ? ((klass)->name) : NULL)
/***********************************************************************
*
* Transform Ids list
*
**********************************************************************/
/**
* xmlSecTransformIdListId:
*
* Transform klasses list klass.
*/
#define xmlSecTransformIdListId xmlSecTransformIdListGetKlass()
XMLSEC_EXPORT xmlSecPtrListId xmlSecTransformIdListGetKlass (void);
XMLSEC_EXPORT int xmlSecTransformIdListFind (xmlSecPtrListPtr list,
xmlSecTransformId transformId);
XMLSEC_EXPORT xmlSecTransformId xmlSecTransformIdListFindByHref (xmlSecPtrListPtr list,
const xmlChar* href,
xmlSecTransformUsage usage);
XMLSEC_EXPORT xmlSecTransformId xmlSecTransformIdListFindByName (xmlSecPtrListPtr list,
const xmlChar* name,
xmlSecTransformUsage usage);
XMLSEC_EXPORT void xmlSecTransformIdListDebugDump (xmlSecPtrListPtr list,
FILE* output);
XMLSEC_EXPORT void xmlSecTransformIdListDebugXmlDump(xmlSecPtrListPtr list,
FILE* output);
/********************************************************************
*
* XML Sec Library Transform Ids
*
*******************************************************************/
/**
* xmlSecTransformIdUnknown:
*
* The "unknown" transform id (NULL).
*/
#define xmlSecTransformIdUnknown ((xmlSecTransformId)NULL)
/**
* xmlSecTransformBase64Id:
*
* The base64 encode transform klass.
*/
#define xmlSecTransformBase64Id \
xmlSecTransformBase64GetKlass()
XMLSEC_EXPORT xmlSecTransformId xmlSecTransformBase64GetKlass (void);
XMLSEC_EXPORT void xmlSecTransformBase64SetLineSize (xmlSecTransformPtr transform,
xmlSecSize lineSize);
/**
* xmlSecTransformInclC14NId:
*
* The regular (inclusive) C14N without comments transform klass.
*/
#define xmlSecTransformInclC14NId \
xmlSecTransformInclC14NGetKlass()
XMLSEC_EXPORT xmlSecTransformId xmlSecTransformInclC14NGetKlass (void);
/**
* xmlSecTransformInclC14NWithCommentsId:
*
* The regular (inclusive) C14N with comments transform klass.
*/
#define xmlSecTransformInclC14NWithCommentsId \
xmlSecTransformInclC14NWithCommentsGetKlass()
XMLSEC_EXPORT xmlSecTransformId xmlSecTransformInclC14NWithCommentsGetKlass(void);
/**
* xmlSecTransformInclC14N11Id:
*
* The regular (inclusive) C14N 1.1 without comments transform klass.
*/
#define xmlSecTransformInclC14N11Id \
xmlSecTransformInclC14N11GetKlass()
XMLSEC_EXPORT xmlSecTransformId xmlSecTransformInclC14N11GetKlass (void);
/**
* xmlSecTransformInclC14N11WithCommentsId:
*
* The regular (inclusive) C14N 1.1 with comments transform klass.
*/
#define xmlSecTransformInclC14N11WithCommentsId \
xmlSecTransformInclC14N11WithCommentsGetKlass()
XMLSEC_EXPORT xmlSecTransformId xmlSecTransformInclC14N11WithCommentsGetKlass(void);
/**
* xmlSecTransformExclC14NId
*
* The exclusive C14N without comments transform klass.
*/
#define xmlSecTransformExclC14NId \
xmlSecTransformExclC14NGetKlass()
XMLSEC_EXPORT xmlSecTransformId xmlSecTransformExclC14NGetKlass (void);
/**
* xmlSecTransformExclC14NWithCommentsId:
*
* The exclusive C14N with comments transform klass.
*/
#define xmlSecTransformExclC14NWithCommentsId \
xmlSecTransformExclC14NWithCommentsGetKlass()
XMLSEC_EXPORT xmlSecTransformId xmlSecTransformExclC14NWithCommentsGetKlass(void);
/**
* xmlSecTransformEnvelopedId:
*
* The "enveloped" transform klass.
*/
#define xmlSecTransformEnvelopedId \
xmlSecTransformEnvelopedGetKlass()
XMLSEC_EXPORT xmlSecTransformId xmlSecTransformEnvelopedGetKlass (void);
/**
* xmlSecTransformXPathId:
*
* The XPath transform klass.
*/
#define xmlSecTransformXPathId \
xmlSecTransformXPathGetKlass()
XMLSEC_EXPORT xmlSecTransformId xmlSecTransformXPathGetKlass (void);
/**
* xmlSecTransformXPath2Id:
*
* The XPath2 transform klass.
*/
#define xmlSecTransformXPath2Id \
xmlSecTransformXPath2GetKlass()
XMLSEC_EXPORT xmlSecTransformId xmlSecTransformXPath2GetKlass (void);
/**
* xmlSecTransformXPointerId:
*
* The XPointer transform klass.
*/
#define xmlSecTransformXPointerId \
xmlSecTransformXPointerGetKlass()
XMLSEC_EXPORT xmlSecTransformId xmlSecTransformXPointerGetKlass (void);
XMLSEC_EXPORT int xmlSecTransformXPointerSetExpr (xmlSecTransformPtr transform,
const xmlChar* expr,
xmlSecNodeSetType nodeSetType,
xmlNodePtr hereNode);
#ifndef XMLSEC_NO_XSLT
#include <libxslt/security.h>
/**
* xmlSecTransformXsltId:
*
* The XSLT transform klass.
*/
#define xmlSecTransformXsltId \
xmlSecTransformXsltGetKlass()
XMLSEC_EXPORT xmlSecTransformId xmlSecTransformXsltGetKlass (void);
XMLSEC_EXPORT void xmlSecTransformXsltSetDefaultSecurityPrefs(xsltSecurityPrefsPtr sec);
#endif /* XMLSEC_NO_XSLT */
/**
* xmlSecTransformRemoveXmlTagsC14NId:
*
* The "remove all xml tags" transform klass (used before base64 transforms).
*/
#define xmlSecTransformRemoveXmlTagsC14NId \
xmlSecTransformRemoveXmlTagsC14NGetKlass()
XMLSEC_EXPORT xmlSecTransformId xmlSecTransformRemoveXmlTagsC14NGetKlass(void);
/**
* xmlSecTransformVisa3DHackId:
*
* Selects node subtree by given node id string. The only reason why we need this
* is Visa3D protocol. It doesn't follow XML/XPointer/XMLDSig specs and allows
* invalid XPointer expressions in the URI attribute. Since we couldn't evaluate
* such expressions thru XPath/XPointer engine, we need to have this hack here.
*/
#define xmlSecTransformVisa3DHackId \
xmlSecTransformVisa3DHackGetKlass()
XMLSEC_EXPORT xmlSecTransformId xmlSecTransformVisa3DHackGetKlass (void);
XMLSEC_EXPORT int xmlSecTransformVisa3DHackSetID (xmlSecTransformPtr transform,
const xmlChar* id);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __XMLSEC_TRANSFORMS_H__ */
|