Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
our_own_cloud_project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
die_coolen_jungs
our_own_cloud_project
Commits
e5704bf8
Commit
e5704bf8
authored
12 years ago
by
Björn Schießle
Browse files
Options
Downloads
Patches
Plain Diff
ocs call to get file key for client side enncryption
parent
f752a276
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/ocs.php
+21
-17
21 additions, 17 deletions
lib/ocs.php
with
21 additions
and
17 deletions
lib/ocs.php
+
21
−
17
View file @
e5704bf8
...
...
@@ -191,9 +191,10 @@ class OC_OCS {
OC_OCS
::
privateKeySet
(
$format
,
$user
,
$key
);
// keygetfiles
}
elseif
((
$method
==
'get'
)
and
(
$ex
[
$paracount
-
6
]
==
'v1.php'
)
and
(
$ex
[
$paracount
-
5
]
==
'cloud'
)
and
(
$ex
[
$paracount
-
4
]
==
'user'
)
and
(
$ex
[
$paracount
-
2
]
==
'filekey'
)){
$user
=
$ex
[
$paracount
-
3
];
OC_OCS
::
fileKeyGet
(
$format
,
$user
);
}
elseif
((
$method
==
'get'
)
and
(
$ex
[
$paracount
-
7
]
==
'v1.php'
)
and
(
$ex
[
$paracount
-
6
]
==
'cloud'
)
and
(
$ex
[
$paracount
-
5
]
==
'user'
)
and
(
$ex
[
$paracount
-
3
]
==
'filekey'
)){
$user
=
$ex
[
$paracount
-
4
];
$file
=
urldecode
(
$ex
[
$paracount
-
2
]);
OC_OCS
::
fileKeyGet
(
$format
,
$user
,
$file
);
//keysetfiles
}
elseif
((
$method
==
'post'
)
and
(
$ex
[
$paracount
-
6
]
==
'v1.php'
)
and
(
$ex
[
$paracount
-
5
]
==
'cloud'
)
and
(
$ex
[
$paracount
-
4
]
==
'user'
)
and
(
$ex
[
$paracount
-
2
]
==
'filekey'
)){
...
...
@@ -734,7 +735,7 @@ class OC_OCS {
$txt
=
OC_OCS
::
generatexml
(
$format
,
'ok'
,
100
,
''
,
$xml
,
'cloud'
,
''
,
1
,
0
,
0
);
echo
(
$txt
);
}
else
{
echo
self
::
generateXml
(
''
,
'fail'
,
404
,
'private
K
ey does not exist'
);
echo
self
::
generateXml
(
''
,
'fail'
,
404
,
'private
k
ey does not exist'
);
}
}
else
{
echo
self
::
generateXml
(
''
,
'fail'
,
300
,
'Client side encryption not enabled for user '
.
$user
);
...
...
@@ -777,15 +778,18 @@ class OC_OCS {
*/
private
static
function
fileKeyGet
(
$format
,
$user
,
$file
)
{
$login
=
OC_OCS
::
checkpassword
();
if
(
OC_Group
::
inGroup
(
$login
,
'admin'
)
or
(
$login
==
$user
))
{
if
(
OC_
User
::
userExists
(
$user
))
{
//TODO: GET file key, check needed if it is a shared file or not
if
((
$login
==
$user
))
{
if
(
OC_
App
::
isEnabled
(
'files_encryption'
)
&&
OCA_Encryption\Crypt
::
mode
(
$user
)
===
'client'
)
{
if
((
$key
=
OCA_Encryption\Keymanager
::
getFileKey
(
$user
,
$file
)))
{
$xml
=
array
();
$xml
[
'key'
]
=
"this is the key for
$file
"
;
$xml
[
'key'
]
=
$key
;
$txt
=
OC_OCS
::
generatexml
(
$format
,
'ok'
,
100
,
''
,
$xml
,
'cloud'
,
''
,
1
,
0
,
0
);
echo
(
$txt
);
}
else
{
echo
self
::
generateXml
(
''
,
'fail'
,
300
,
'User does not exist'
);
echo
self
::
generateXml
(
''
,
'fail'
,
404
,
'file key does not exist'
);
}
}
else
{
echo
self
::
generateXml
(
''
,
'fail'
,
300
,
'Client side encryption not enabled for user '
.
$user
);
}
}
else
{
echo
self
::
generateXml
(
''
,
'fail'
,
300
,
'You don´t have permission to access this ressource.'
);
...
...
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