Main Page | Modules | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

XSECCryptoUtils.hpp

Go to the documentation of this file.
00001 /*
00002  * Copyright 2002-2005 The Apache Software Foundation.
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 /*
00018  * XSEC
00019  *
00020  * XSECCryptoUtils:= Helper crypo utilities that make life easier
00021  *
00022  * Author(s): Berin Lautenbach
00023  *
00024  * $Id: XSECCryptoUtils.hpp 450743 2006-09-28 07:51:31Z blautenb $
00025  *
00026  */
00027 
00028 #ifndef XSECCRYPTOUTILS_INCLUDE
00029 #define XSECCRYPTOUTILS_INCLUDE
00030 
00031 #include <xsec/framework/XSECDefs.hpp>
00032 #include <xsec/utils/XSECSafeBuffer.hpp>
00033 #include <xsec/dsig/DSIGConstants.hpp>
00034 
00040 // --------------------------------------------------------------------------------
00041 //           XKMS Limited-Use Shared Secret handling
00042 // --------------------------------------------------------------------------------
00043 
00044 #define XKMSAuthenticationValue                 0x01
00045 #define XKMSRevocationCodeIdenfitierEncoding1   0x02
00046 #define XKMSRevocationCodeIdenfitierEncoding2   0x03
00047 #define XKMSKeyEncryption                       0x04
00048 
00049 int DSIG_EXPORT CalculateXKMSAuthenticationKey(unsigned char * input, int inputLen, unsigned char * output, int maxOutputLen);
00050 int DSIG_EXPORT CalculateXKMSRevocationCodeIdentifierEncoding1(unsigned char * input, int inputLen, unsigned char * output, int maxOutputLen);
00051 /* Calculate encoding 2 - Input is original pass phrase */
00052 int DSIG_EXPORT CalculateXKMSRevocationCodeIdentifierEncoding2(unsigned char * input, int inputLen, unsigned char * output, int maxOutputLen);
00053 /* Calculate encoding 2 - Input is encoding 1 */
00054 int DSIG_EXPORT CalculateXKMSRevocationCodeIdentifierEncoding2From1(unsigned char * input, int inputLen, unsigned char * output, int maxOutputLen);
00055 int DSIG_EXPORT CalculateXKMSKEK(unsigned char * input, int inputLen, unsigned char * output, int maxOutputLen);
00056 
00057 // --------------------------------------------------------------------------------
00058 //           Some Base64 helpers
00059 // --------------------------------------------------------------------------------
00060 
00061 XMLCh DSIG_EXPORT * EncodeToBase64XMLCh(unsigned char * input, int inputLen);
00062 unsigned int DSIG_EXPORT DecodeFromBase64XMLCh(const XMLCh * input, unsigned char * output, int maxOutputLen);
00063 unsigned int DSIG_EXPORT DecodeFromBase64(const char * input, unsigned char * output, int maxOutputLen);
00064 
00065 // --------------------------------------------------------------------------------
00066 //           Some stuff to help with wierd signatures
00067 // --------------------------------------------------------------------------------
00068 
00069 // Convert an ASN.1 format DSA signature (!!!) to the two component integers
00070 // NOTE - both r and s must be at least 20 bytes long
00071 
00072 bool DSIG_EXPORT ASN2DSASig(const unsigned char * input, unsigned char * r, unsigned char * s);
00073 
00074 // --------------------------------------------------------------------------------
00075 //           Calculate correct OIDs for an RSA sig
00076 // --------------------------------------------------------------------------------
00077 
00078 unsigned char * getRSASigOID(hashMethod hm, int &oidLen);
00079 
00080 #endif /* XSECCRYPTOUTILS_INCLUDE */
00081 
00082 

Generated on Sun Jan 28 19:37:24 2007 for XML-Security-C by  doxygen 1.4.2