Working with sensitive data: Difference between revisions
Jump to navigation
Jump to search
(placeholder for encryption and decryption codes) |
|||
(6 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
{{method|moderator=Jouni}} | {{method|moderator=Jouni}} | ||
[[Category:Code under inspection]] | |||
==Question== | ==Question== | ||
Line 7: | Line 8: | ||
==Answer== | ==Answer== | ||
== | === Encode and save a table as object === | ||
; This interface encodes (encrypts) a table and saves it as an R object into the Opasnet server. You can retrieve the data using the code below by giving the password you gave here and the key of the model run (from the URL). | |||
<rcode name='obj_encode_test' | <rcode name='obj_encode_test' | ||
variables=" | variables=" | ||
name:table|description: | name:table|description:Paste your table here|type:table| | ||
name: | name:password|type:password|description:Password (16,32, or 64 ascii characters) | ||
" | " | ||
> | > | ||
library(OpasnetUtils) | library(OpasnetUtils) | ||
cat(paste("The table has", nrow(table), "rows and", ncol(table), "columns with names...\n", sep = " ")) | |||
etable <- objects.encode(table, | oprint(table[1, ]) | ||
etable <- objects.encode(table, password) | |||
objects.put(etable) | objects.put(etable) | ||
cat("The table has been encrypted and saved with name etable. Please write down the key of the run and your password, otherwise you will not be able to retrieve your data.\nDO NOT REMOVE THIS RUN, JUST CLOSE THE BROWSER WINDOW. Otherwise you will permanently remove your encrypted table.\n") | |||
</rcode> | </rcode> | ||
== | === Open and decode (decrypt) a saved object === | ||
; You can open and decode a previously saved data by giving the key of the model run and the password you then created. | |||
<rcode name='obj_decode_test' | <rcode name='obj_decode_test' | ||
variables=" | variables=" | ||
name:token|type:text|description:Identifier of the run| | name:token|type:text|description:Identifier of the run| | ||
name: | name:password|type:password|description:Password (16,32, or 64 ascii characters) | ||
" | " | ||
> | > | ||
library(OpasnetUtils) | library(OpasnetUtils) | ||
objects.get(token) | objects.get(token) | ||
table <- objects.decode(etable, key) | table <- objects.decode(etable, password) | ||
oprint(table) | |||
</rcode> | |||
=== Working with non-sensitive data=== | |||
; You can also save and retrieve non-sensitive data, which anyone can open and see if they just have the key of the run that created the objects. | |||
<rcode name='obj_save' | |||
variables="name:table1|description:Paste your table here|type:table" | |||
> | |||
library(OpasnetUtils) | |||
cat(paste("The table has", nrow(table1), "rows and", ncol(table1), "columns with names...\n", sep = " ")) | |||
oprint(table1[1, ]) | |||
objects.put(table1) | |||
cat("The table has been saved with name 'table1'. Please write down the key of the run, otherwise you will not be able to retrieve your data.\nDO NOT REMOVE THIS RUN, JUST CLOSE THE BROWSER WINDOW. Otherwise you will permanently remove your table.\n") | |||
</rcode> | |||
; You can open a previously saved data by giving the key of the model run. | |||
<rcode name='obj_open' | |||
variables="name:token|type:text|description:Identifier of the run" | |||
> | |||
library(OpasnetUtils) | |||
objects.get(token) | |||
oprint(table) | |||
</rcode> | </rcode> | ||
==See also== | |||
==References== | |||
<references/> | |||
==Related files== | |||
{{mfiles}} |
Latest revision as of 08:14, 8 May 2014
Moderator:Jouni (see all) |
|
Upload data
|
Question
How to work with data that has sensitive parts?
Answer
Encode and save a table as object
- This interface encodes (encrypts) a table and saves it as an R object into the Opasnet server. You can retrieve the data using the code below by giving the password you gave here and the key of the model run (from the URL).
Open and decode (decrypt) a saved object
- You can open and decode a previously saved data by giving the key of the model run and the password you then created.
Working with non-sensitive data
- You can also save and retrieve non-sensitive data, which anyone can open and see if they just have the key of the run that created the objects.
- You can open a previously saved data by giving the key of the model run.
See also
References
Related files
<mfanonymousfilelist></mfanonymousfilelist>