Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
jio_mebibou
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Alexandra Rogova
jio_mebibou
Commits
8d3d5de3
Commit
8d3d5de3
authored
Oct 19, 2015
by
lucas.parsy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactored cryptstorage.js: renamed 'iv' 'initialization_vector'
parent
cd5d8f0c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
6 deletions
+12
-6
src/jio.storage/cryptstorage.js
src/jio.storage/cryptstorage.js
+12
-6
No files found.
src/jio.storage/cryptstorage.js
View file @
8d3d5de3
...
...
@@ -71,7 +71,7 @@
CryptStorage
.
prototype
.
putAttachment
=
function
(
id
,
name
,
blob
)
{
var
i
v
=
crypto
.
getRandomValues
(
new
Uint8Array
(
12
)),
var
i
nitializaton_vector
=
crypto
.
getRandomValues
(
new
Uint8Array
(
12
)),
that
=
this
;
return
new
RSVP
.
Queue
()
...
...
@@ -89,11 +89,14 @@
for
(
i
=
0
;
i
<
strLen
;
i
+=
1
)
{
bufView
[
i
]
=
dataURL
.
charCodeAt
(
i
);
}
return
crypto
.
subtle
.
encrypt
({
name
:
"
AES-GCM
"
,
iv
:
iv
},
return
crypto
.
subtle
.
encrypt
({
name
:
"
AES-GCM
"
,
initializaton_vector
:
initializaton_vector
},
that
.
_key
,
buf
);
})
.
push
(
function
(
coded
)
{
var
blob
=
new
Blob
([
i
v
,
coded
],
{
type
:
MIME_TYPE
});
var
blob
=
new
Blob
([
i
nitializaton_vector
,
coded
],
{
type
:
MIME_TYPE
});
return
that
.
_sub_storage
.
putAttachment
(
id
,
name
,
blob
);
});
};
...
...
@@ -111,11 +114,14 @@
return
jIO
.
util
.
readBlobAsArrayBuffer
(
blob
);
})
.
push
(
function
(
coded
)
{
var
i
v
;
var
i
nitializaton_vector
;
coded
=
coded
.
currentTarget
.
result
;
iv
=
new
Uint8Array
(
coded
.
slice
(
0
,
12
));
return
crypto
.
subtle
.
decrypt
({
name
:
"
AES-GCM
"
,
iv
:
iv
},
initializaton_vector
=
new
Uint8Array
(
coded
.
slice
(
0
,
12
));
return
crypto
.
subtle
.
decrypt
({
name
:
"
AES-GCM
"
,
initializaton_vector
:
initializaton_vector
},
that
.
_key
,
coded
.
slice
(
12
));
})
.
push
(
function
(
arr
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment