Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
180 lines (164 loc) · 5.09 KB

File metadata and controls

180 lines (164 loc) · 5.09 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
<!doctype html>
<html>
<head>
<title>PubNub Crypto</title>
<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.0/css/bootstrap-combined.min.css" rel="stylesheet">
<style>body {padding-top:60px}</style>
<style>
#output {
font-family: mono,monospace;
}
code {
border: 1px solid #eee;
border-radius: 3px;
background: #ffe;
display: inline-block;
padding: 3px;
}
input {
width: 300px;
}
textarea {
width: 650px;
height: 80px;
}
</style>
</head>
<body>
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="#">PubNub Enterprise Cryptography</a>
<div class="nav-collapse">
<ul class="nav">
<li class="active"><a href="#">Stanford Cryptography</a></li>
</ul>
</div>
</div>
</div>
</div>
<div class=container>
<h1>PubNub Cryptography in JavaScript</h1>
<p>
This HTML page demonstrates with PubNub Cryptography for sensitive data.
Use this page and source code to provide high levels of security
for data intended to be private and unreadable.
The Cipher Key specifies the particular transformation
of plaintext into ciphertext, or vice versa during decryption.
</p>
<h4>Cryptographic Cipher Key</h4>
<textarea id=cipher_key>
SkQjKkhZR1NKRExLRkhVNGF0eTdhdHIgcGpvYXRyZWggZlNEQU9VIFlGVyRZV15FR1UgcGhpIGZz
cG9oaSB0ZWktPXNlZj0tYXNmZGppbyBmc2Rnb3kgRFNGVVlBRlUgT0dSIElVUElPRkVGSHVER0hT
bGtqaCBsa2d1aXVhc2ZoeUYgREpLU1lZVFIkXlRVSUhUS0VKSEpMS0YgT0lVRlQmT1EjVVBJVE8m
Knk0ODc1NDU3OF4mQSYkUmZGREtTTEogYWRnaHMjKiNqa3NobGt0NGpsa2FpdWFoNHR1aEZLSkRT
</textarea>
<div class=row>
<div class=span5>
<h4>Secure Entropic Channel</h4>
<input
id=channel
class=span5
value=hwSUdaeg0KY0c5b2FTQjBaV2t0UFhObFpqMHRZWE5tW
>
<h4>Publish Key</h4>
<input
id=pub
class=span5
value=ea1afbc1-70a3-43c1-990c-ede5cf65a542
>
<h4>Subscribe Key</h4>
<input
id=sub
class=span5
value=e19f2bb0-623a-11df-98a1-fbd39d75aa3f
>
</div>
<div class=span5>
<h4>Cloud Cluster Origin</h4>
<input
id=origin
class=span5
value=pubsub.pubnub.com
>
<h4>2048bit SSL Encryption</h4>
<input
id=ssl
class=span5
value=ON
>
<h4>Secure Message</h4>
<input
id=message
class=span5
value="Kerckhoffs' Principle: only secrecy of the key provides security."
>
</div>
</div>
<h4>Encrypted Traffic</h4>
<p>
View the Source Code of <code>index.html</code> to see how Encryption is handled.
See the <code>encrypt-pubnub.js</code> file to learn more about the
implementation used by PubNub JavaScript client.
</p>
<p>
<a id=start class="btn btn-primary btn-large">Start Encrypted Message Traffic</a>
</p>
<div id=output class=well></div>
<div id=pubnub></div>
<script src=../pubnub.min.js></script>
<script src=../pubnub-crypto.min.js></script>
<script>(function(){
// =====================================================================
// PUBNUB SEND/RECEIVE DATA ENCRYPTED
// =====================================================================
var start_button = PUBNUB.$('start');
PUBNUB.bind(
'mousedown,touchstart',
start_button,
start_traffic
);
function start_traffic() {
if (start_button.disabled) return;
var publish_key = PUBNUB.$('pub').value;
var subscribe_key = PUBNUB.$('sub').value;
var channel = PUBNUB.$('channel').value;
var origin = PUBNUB.$('origin').value;
var message = PUBNUB.$('message');
var output = PUBNUB.$('output');
var cipher_key = PUBNUB.$('cipher_key')
.value.split(/\s/).join('');
var secure_pubnub = PUBNUB.secure({
publish_key : publish_key,
subscribe_key : subscribe_key,
origin : origin,
ssl : true,
cipher_key : cipher_key
});
output.count = 1;
secure_pubnub.subscribe({
channel : channel,
connect : send_message,
message : function(message) {
output.innerHTML = output.count++ + ': ' +
message + '<br>' + output.innerHTML;
}
});
function send_message() {
secure_pubnub.publish({
channel : channel,
message : message.value
});
}
send_message();
setInterval( send_message, 1000);
PUBNUB.attr(
start_button,
'class',
'btn btn-large disabled'
);
start_button.disabled = true;
}
})();</script>
</div></body>
</html>
Morty Proxy This is a proxified and sanitized view of the page, visit original site.