-
Notifications
You must be signed in to change notification settings - Fork 4
/
tabsecurity.php
106 lines (88 loc) · 4.07 KB
/
tabsecurity.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<?php
//-----------------------------------------------------------------------------------------------------------------------------------
//
// Filename : tabsecurity.php
// Date : 15th October 2009
//
// Copyright 2008-2009 foaf.me
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// "Everything should be made as simple as possible, but no simpler."
// -- Albert Einstein
//
//-----------------------------------------------------------------------------------------------------------------------------------
// This tab can act as a standalone page or be included from a containter
require_once('head.php');
require_once('header.php');
require_once('lib/Authentication.php');
if ($_REQUEST['webid']) {
$pageAgent = new Authentication_AgentARC($GLOBALS['config'], $_REQUEST['webid']);
$agent = $pageAgent->getAgent();
}
if ( $auth->isAuthenticated() )
$agent = $auth->getAgent();
if ( $auth->isAuthenticated() || !empty($_REQUEST['webid']) ) {
$key_array = $agent['RSAKey'];
print "<h3>Security</h3>";
if (!empty($key_array)) {
// TODO: rdfa to match the table below
foreach ($key_array as $i => $key) {
$wrapped_pub_key = wordwrap($key[modulus], 80, "<br />", true);
echo $i.".<br/>";
echo "Public Key:<br/>".$wrapped_pub_key."<br/>";
echo "Exponent: $key[exponent]<br/>";
echo "<br />";
}
} else {
print 'This identity is not yet protected.<form name="input" action="' . $config['certficate_uri'] .'" method="get">';
?>
<div>
<input type="hidden" size="25" id="foaf" name="foaf" value="<?php echo $_REQUEST['webid'] ?>">
Key Strength: <keygen name="pubkey" challenge="randomchars"></td><td></td><td></td>
<input type="hidden" id="commonName" name="commonName" value="FOAF ME Cert <?php echo $_REQUEST['webid'] ?>"><button id="generate" type="submit">Claim Account with SSL Certificate!</button>
<input type="hidden" id="uri" name="uri" value="<?php echo $_REQUEST['webid'] ?>">
</div>
</form>
<a href="https://foaf.me/simpleLogin.php">Test</a>
<?php }
print "<h3>Coming soon</h3>";
print "Edit profile (please use tabulator at the moment)<br/> ";
print "Privacy control<br/>";
} else {
?>
<table typeof="cert:identity">
<tr>
<td><b>Secure Account!</b></td>
<td>(RSA)</td>
</tr>
<tr>
<td>Public Key:</td>
<td><input class="cert:hex" property="rsa:modulus" id="publicKey"
onchange="makeTags()" type="text" name="publicKey" />
</td>
</tr>
<tr>
<td>Exponent:</td>
<td><input class="cert:decimal" property="rsa:public_exponent"
id="exponent" onchange="makeTags()" type="text" name="exponent" />
(Default = 65537)
</td>
</tr>
</table>
<?php }
if (realpath(__FILE__) == realpath($_SERVER['SCRIPT_FILENAME'])) {
require_once("footer.php");
}
?>