Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
persona
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hexang 息壤平台
persona
Commits
7b140b05
Commit
7b140b05
authored
13 years ago
by
Ben Adida
Browse files
Options
Downloads
Patches
Plain Diff
updated jwcrypto and now using jwk
parent
19929151
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
browserid/lib/ca.js
+4
-7
4 additions, 7 deletions
browserid/lib/ca.js
browserid/tests/ca-test.js
+2
-1
2 additions, 1 deletion
browserid/tests/ca-test.js
browserid/tests/cert-emails-test.js
+2
-1
2 additions, 1 deletion
browserid/tests/cert-emails-test.js
lib/jwcrypto
+1
-1
1 addition, 1 deletion
lib/jwcrypto
with
9 additions
and
10 deletions
browserid/lib/ca.js
+
4
−
7
View file @
7b140b05
...
...
@@ -37,6 +37,7 @@
// certificate authority
var
jwcert
=
require
(
'
../../lib/jwcrypto/jwcert
'
),
jwk
=
require
(
'
../../lib/jwcrypto/jwk
'
),
jws
=
require
(
'
../../lib/jwcrypto/jws
'
),
configuration
=
require
(
'
../../libs/configuration
'
),
path
=
require
(
"
path
"
),
...
...
@@ -54,10 +55,7 @@ function loadSecretKey(name, dir) {
}
// parse it
// it should be a JSON structure with alg and serialized key
// {alg: <ALG>, value: <SERIALIZED_KEY>}
var
key
=
JSON
.
parse
(
secret
);
return
jws
.
getByAlg
(
key
.
alg
).
SecretKey
.
deserialize
(
key
.
value
);
return
jwk
.
SecretKey
.
deserialize
(
secret
);
}
function
loadPublicKey
(
name
,
dir
)
{
...
...
@@ -74,15 +72,14 @@ function loadPublicKey(name, dir) {
// parse it
// it should be a JSON structure with alg and serialized key
// {alg: <ALG>, value: <SERIALIZED_KEY>}
var
key
=
JSON
.
parse
(
secret
);
return
jws
.
getByAlg
(
key
.
alg
).
PublicKey
.
deserialize
(
key
.
value
);
return
jwk
.
PublicKey
.
deserialize
(
secret
);
}
var
SECRET_KEY
=
loadSecretKey
(
'
root
'
,
configuration
.
get
(
'
var_path
'
));
var
PUBLIC_KEY
=
loadPublicKey
(
'
root
'
,
configuration
.
get
(
'
var_path
'
));
function
parsePublicKey
(
serializedPK
)
{
return
jw
s
.
getByAlg
(
"
RS
"
)
.
PublicKey
.
deserialize
(
serializedPK
);
return
jw
k
.
PublicKey
.
deserialize
(
serializedPK
);
}
function
parseCert
(
serializedCert
)
{
...
...
This diff is collapsed.
Click to expand it.
browserid/tests/ca-test.js
+
2
−
1
View file @
7b140b05
...
...
@@ -44,6 +44,7 @@ wsapi = require('./lib/wsapi.js'),
email
=
require
(
'
../lib/email.js
'
),
ca
=
require
(
'
../lib/ca.js
'
),
jwcert
=
require
(
'
../../lib/jwcrypto/jwcert
'
),
jwk
=
require
(
'
../../lib/jwcrypto/jwk
'
),
jws
=
require
(
'
../../lib/jwcrypto/jws
'
);
var
suite
=
vows
.
describe
(
'
ca
'
);
...
...
@@ -52,7 +53,7 @@ var suite = vows.describe('ca');
suite
.
options
.
error
=
false
;
// generate a public key
var
kp
=
jw
s
.
getByAlg
(
"
RS
"
)
.
KeyPair
.
generate
(
64
);
var
kp
=
jw
k
.
KeyPair
.
generate
(
"
RS
"
,
64
);
var
email_addr
=
"
foo@foo.com
"
;
...
...
This diff is collapsed.
Click to expand it.
browserid/tests/cert-emails-test.js
+
2
−
1
View file @
7b140b05
...
...
@@ -44,6 +44,7 @@ wsapi = require('./lib/wsapi.js'),
email
=
require
(
'
../lib/email.js
'
),
ca
=
require
(
'
../lib/ca.js
'
),
jwcert
=
require
(
'
../../lib/jwcrypto/jwcert
'
),
jwk
=
require
(
'
../../lib/jwcrypto/jwk
'
),
jws
=
require
(
'
../../lib/jwcrypto/jws
'
);
var
suite
=
vows
.
describe
(
'
cert-emails
'
);
...
...
@@ -104,7 +105,7 @@ var cert_key_url = "/wsapi/cert_key";
// generate a keypair, we'll use this to sign assertions, as if
// this keypair is stored in the browser localStorage
var
kp
=
jw
s
.
getByAlg
(
"
RS
"
)
.
KeyPair
.
generate
(
64
);
var
kp
=
jw
k
.
KeyPair
.
generate
(
"
RS
"
,
64
);
suite
.
addBatch
({
"
cert key with no parameters
"
:
{
...
...
This diff is collapsed.
Click to expand it.
jwcrypto
@
36562ebe
Compare
9aaa4c07
...
36562ebe
Subproject commit
9aaa4c075c9b4f6188b5f0098e641f21f2c30a2a
Subproject commit
36562ebe7ed0ad0823206167ee1fa11ecc3c682d
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment