1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_xmlsecurity.hxx"
34 #include <tools/date.hxx>
35 #include <tools/time.hxx>
36 #include <cppuhelper/servicefactory.hxx>
38 #include <xmlsecurity/biginteger.hxx>
39 #include <xmlsecurity/xmlsignaturehelper.hxx>
40 #include <com/sun/star/mozilla/XMozillaBootstrap.hpp>
42 using namespace ::com::sun::star
;
44 int SAL_CALL
main( int argc
, char **argv
)
46 fprintf( stdout
, "\nTesting Mozilla Profile Detection...\n\nOpenOffice.org will use the first detected profile.\nResults might be different when started in OOo program folder!\n" ) ;
48 uno::Reference
< lang::XMultiServiceFactory
> xMSF
= CreateDemoServiceFactory();
51 fprintf( stdout
, "\n\nERROR: Can't create Service Factory\n" );
55 uno::Reference
<mozilla::XMozillaBootstrap
> xMozillaBootstrap( xMSF
->createInstance(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.mozilla.MozillaBootstrap" ) ) ), uno::UNO_QUERY
);
56 if ( !xMozillaBootstrap
.is() )
58 fprintf( stdout
, "\n\nERROR: Can't create Mozilla Bootstrap Service\n" );
63 mozilla::MozillaProductType productTypes
[4] = { mozilla::MozillaProductType_Thunderbird
, mozilla::MozillaProductType_Mozilla
, mozilla::MozillaProductType_Firefox
, mozilla::MozillaProductType_Default
};
64 for ( int i
= 0; i
< nProducts
; i
++)
67 fprintf( stdout
, "\nThunderbird: " );
69 fprintf( stdout
, "\nMozilla: " );
71 fprintf( stdout
, "\nFireFox: " );
73 fprintf( stdout
, "\nDefault: " );
75 ::rtl::OUString profile
= xMozillaBootstrap
->getDefaultProfile(productTypes
[i
]);
76 if ( profile
.getLength() )
78 ::rtl::OUString profilepath
= xMozillaBootstrap
->getProfilePath(productTypes
[i
],profile
);
79 fprintf( stdout
, "Name=%s, Path=%s", rtl::OUStringToOString( profile
, RTL_TEXTENCODING_ASCII_US
).getStr(), rtl::OUStringToOString( profilepath
, RTL_TEXTENCODING_ASCII_US
).getStr() );
83 fprintf( stdout
, "NOT FOUND" );
88 * creates a signature helper
90 XMLSignatureHelper
aSignatureHelper( xMSF
);
93 * creates a security context.
95 rtl::OUString aCryptoToken
;
96 bool bInit
= aSignatureHelper
.Init( aCryptoToken
);
99 fprintf( stdout
, "\n\nERROR: Unable to initialize security environment.\n\n" );
103 fprintf( stdout
, "\n\nSecurity environment can be initialized successfully.\n\n" );