reSIProcate/stack  9694
testPksc7.cxx
Go to the documentation of this file.
00001 #include <iostream>
00002 #include <memory>
00003 
00004 #include "resip/stack/Pkcs7Contents.hxx"
00005 #include "resip/stack/SipMessage.hxx"
00006 #include "resip/stack/test/TestSupport.hxx"
00007 #include "rutil/Logger.hxx"
00008 
00009 using namespace resip;
00010 using namespace std;
00011 
00012 int
00013 main(int argc, char** argv)
00014 {
00015    Log::initialize(Log::Cout, Log::Debug, argv[0]);
00016 
00017    {
00018       const Data txt("To: <sip:fluffy@h1.cisco1.sipit.net:5060>\r\n"
00019                      "From: <sip:user@localhost:5080>;tag=2122f945\r\n"
00020                      "Via: SIP/2.0/UDP 212.157.205.40:5080;branch=z9hG4bK-c87542-472657511-2--c87542-;rport=5080;received=212.157.205.40\r\n"
00021                      "Call-ID: 5e50445050086b2e\r\n"
00022                      "CSeq: 1 MESSAGE\r\n"
00023                      "Contact: <sip:user@212.157.205.40:5080>\r\n"
00024                      "Max-Forwards: 70\r\n"
00025                      "Content-Disposition: attachment;handling=required;filename=smime.p7\r\n"
00026                      "Content-Type: application/pkcs7-mime;smime-type=enveloped-data;name=smime.p7m\r\n"
00027                      "User-Agent: SIPimp.org/0.2.3 (curses)\r\n"
00028                      "Content-Length: 385\r\n"
00029                      "\r\n"
00030                      "0%82%01}%06%09*%86H%86%f7%0d%01%07%03%a0%82%01n0%82%01j%02%01%001%82%01%160%\r\n"
00031                      "82%01%12%02%01%000{0p1%0b0%\r\n"
00032                      "09%06%03U%04%06%13%02US1%130%11%06%03U%04%08%13%0aCalifornia1%110%0f%06%03U%\r\n"
00033                      "04%07%13%08San Jose1%0e0%0c\r\n"
00034                      "%06%03U%04%0a%13%05sipit1)0'%06%03U%04%0b%13 Sipit Test Certificate\r\n"
00035                      "Authority%02%07U%01%81%02I%00v0%0d%\r\n"
00036                      "06%09*%86H%86%f7%0d%01%01%01%05%00%04%81%80%80nYR%ba%a1%14%9eV%1c%9b<%f3%80%\r\n"
00037                      "a7%c3%92%b8%0e%10%7f%n%f2%9\r\n"
00038                      "1(%83%f1n%94%18dS}yi?%11B%cf%d6%00x1%d0jf$%8f%f5%e0l%d3~%b1%1e%e6%db%b7%af%1\r\n"
00039                      "0w%ca%fc%b9%19%f9r%b6%8a4%f\r\n"
00040                      "0%d1,t%83%de+%b0%1f%8b%05'%c6%af%c5%dc9%1d%cb%9f7!%08%15%d2A%0b%f2y\"%03%84%e\r\n"
00041                      "3R%16%c6%15f%baf%e1/P%04Os%\r\n"
00042                      "90%ea%e9%a1%a8H1%a2%ad%99%a70K%06%09*%86H%86%f7%0d%01%07%010%14%06%08*%86H%8\r\n"
00043                      "6%f7%0d%03%07%04%08%d7%a3%1\r\n"
00044                      "4%02%8fO\"%ef%80(%d1_%05%9e%118@%87%b0%a4%87%e45%e4[1%8b%e6%d2%b2%e4%d3.%08%\r\n"
00045                      "93%16%f0%cf(%86%d3%10%b6%ff\r\n"
00046                      "%cf%88G%81W");
00047 
00048       auto_ptr<SipMessage> msg(TestSupport::makeMessage(txt.c_str()));
00049 
00050       Pkcs7Contents* pkc = dynamic_cast<Pkcs7Contents*>(msg->getContents());
00051       assert(pkc);
00052    }
00053 
00054    cerr << "All OK" << endl;
00055    return 0;
00056 }
00057 
00058 /* ====================================================================
00059  * The Vovida Software License, Version 1.0 
00060  * 
00061  * Copyright (c) 2000 Vovida Networks, Inc.  All rights reserved.
00062  * 
00063  * Redistribution and use in source and binary forms, with or without
00064  * modification, are permitted provided that the following conditions
00065  * are met:
00066  * 
00067  * 1. Redistributions of source code must retain the above copyright
00068  *    notice, this list of conditions and the following disclaimer.
00069  * 
00070  * 2. Redistributions in binary form must reproduce the above copyright
00071  *    notice, this list of conditions and the following disclaimer in
00072  *    the documentation and/or other materials provided with the
00073  *    distribution.
00074  * 
00075  * 3. The names "VOCAL", "Vovida Open Communication Application Library",
00076  *    and "Vovida Open Communication Application Library (VOCAL)" must
00077  *    not be used to endorse or promote products derived from this
00078  *    software without prior written permission. For written
00079  *    permission, please contact vocal@vovida.org.
00080  *
00081  * 4. Products derived from this software may not be called "VOCAL", nor
00082  *    may "VOCAL" appear in their name, without prior written
00083  *    permission of Vovida Networks, Inc.
00084  * 
00085  * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
00086  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00087  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
00088  * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL VOVIDA
00089  * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
00090  * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
00091  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00092  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00093  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
00094  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00095  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
00096  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
00097  * DAMAGE.
00098  * 
00099  * ====================================================================
00100  * 
00101  * This software consists of voluntary contributions made by Vovida
00102  * Networks, Inc. and many individuals on behalf of Vovida Networks,
00103  * Inc.  For more information on Vovida Networks, Inc., please see
00104  * <http://www.vovida.org/>.
00105  *
00106  */