1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: mozprofile.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_xmlsecurity.hxx"
37 #include <tools/date.hxx>
38 #include <tools/time.hxx>
39 #include <cppuhelper/servicefactory.hxx>
41 #include <xmlsecurity/biginteger.hxx>
42 #include <xmlsecurity/xmlsignaturehelper.hxx>
43 #include <com/sun/star/mozilla/XMozillaBootstrap.hpp>
45 using namespace ::com::sun::star
;
47 int SAL_CALL
main( int argc
, char **argv
)
49 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" ) ;
51 uno::Reference
< lang::XMultiServiceFactory
> xMSF
= CreateDemoServiceFactory();
54 fprintf( stdout
, "\n\nERROR: Can't create Service Factory\n" );
58 uno::Reference
<mozilla::XMozillaBootstrap
> xMozillaBootstrap( xMSF
->createInstance(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.mozilla.MozillaBootstrap" ) ) ), uno::UNO_QUERY
);
59 if ( !xMozillaBootstrap
.is() )
61 fprintf( stdout
, "\n\nERROR: Can't create Mozilla Bootstrap Service\n" );
66 mozilla::MozillaProductType productTypes
[4] = { mozilla::MozillaProductType_Thunderbird
, mozilla::MozillaProductType_Mozilla
, mozilla::MozillaProductType_Firefox
, mozilla::MozillaProductType_Default
};
67 for ( int i
= 0; i
< nProducts
; i
++)
70 fprintf( stdout
, "\nThunderbird: " );
72 fprintf( stdout
, "\nMozilla: " );
74 fprintf( stdout
, "\nFireFox: " );
76 fprintf( stdout
, "\nDefault: " );
78 ::rtl::OUString profile
= xMozillaBootstrap
->getDefaultProfile(productTypes
[i
]);
79 if ( profile
.getLength() )
81 ::rtl::OUString profilepath
= xMozillaBootstrap
->getProfilePath(productTypes
[i
],profile
);
82 fprintf( stdout
, "Name=%s, Path=%s", rtl::OUStringToOString( profile
, RTL_TEXTENCODING_ASCII_US
).getStr(), rtl::OUStringToOString( profilepath
, RTL_TEXTENCODING_ASCII_US
).getStr() );
86 fprintf( stdout
, "NOT FOUND" );
91 * creates a signature helper
93 XMLSignatureHelper
aSignatureHelper( xMSF
);
96 * creates a security context.
98 rtl::OUString aCryptoToken
;
99 bool bInit
= aSignatureHelper
.Init( aCryptoToken
);
102 fprintf( stdout
, "\n\nERROR: Unable to initialize security environment.\n\n" );
106 fprintf( stdout
, "\n\nSecurity environment can be initialized successfully.\n\n" );