android: Register local certificate store provider when the app is initialized
[strongswan.git] / src / frontends / android / src / org / strongswan / android / logic / StrongSwanApplication.java
1 /*
2 * Copyright (C) 2014 Tobias Brunner
3 * Hochschule fuer Technik Rapperswil
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 */
15
16 package org.strongswan.android.logic;
17
18 import java.security.Security;
19
20 import org.strongswan.android.security.LocalCertificateKeyStoreProvider;
21
22 import android.app.Application;
23 import android.content.Context;
24
25 public class StrongSwanApplication extends Application
26 {
27 private static Context mContext;
28
29 static {
30 Security.addProvider(new LocalCertificateKeyStoreProvider());
31 }
32
33 @Override
34 public void onCreate()
35 {
36 super.onCreate();
37 StrongSwanApplication.mContext = getApplicationContext();
38 }
39
40 /**
41 * Returns the current application context
42 * @return context
43 */
44 public static Context getContext()
45 {
46 return StrongSwanApplication.mContext;
47 }
48 }