Working with sensitive data: Difference between revisions

From Opasnet
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==


== Object encoding test ==
=== 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:Tähän voit pastettaa taulun|type:table|
name:table|description:Paste your table here|type:table|
name:key|type:password|description:Salausavain (16,32 tai 64 ascii-merkkiä)
name:password|type:password|description:Password (16,32, or 64 ascii characters)
"
"
>
>


library(OpasnetUtils)
library(OpasnetUtils)
library(xtable)


print(xtable(head(table)), type='html')
cat(paste("The table has", nrow(table), "rows and", ncol(table), "columns with names...\n", sep = " "))
etable <- objects.encode(table, key)
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>


== Object decoding test ==
=== 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:key|type:password|description:Encryption key (16,32, or 64 ascii characters)
name:password|type:password|description:Password (16,32, or 64 ascii characters)
"
"
>
>


library(OpasnetUtils)
library(OpasnetUtils)
library(xtable)


objects.get(token)
objects.get(token)
table <- objects.decode(etable, key)
table <- objects.decode(etable, password)
print(xtable(table), type='html')
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

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).

Paste your table here:

Cancel

Password (16,32, or 64 ascii characters):

+ Show code

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.

Identifier of the run:

Password (16,32, or 64 ascii characters):

+ Show code

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.

Paste your table here:

Cancel

+ Show code

You can open a previously saved data by giving the key of the model run.

Identifier of the run:

+ Show code

See also

References


Related files

<mfanonymousfilelist></mfanonymousfilelist>