Anyone here has any experience using raspberry and sites like bittaddress.org for creating a paper wallet?
I mean, Instead of using a PC, we use a raspberry to access the website, load the page, disconnect, create the wallet, print the wallet, then format the whole raspberry SD card.
Is it safe to do that?
As far as I know that should be safe to do. You may want to run a test on it first with a small amount just to check it works.
The only concern I have about it is how effective a raspberry is at generating random data. Normal PCs employ random events such as interrupts and hard drive reads. A raspberry has no hard drive, it lacks one of the biggest sources of random data available to PCs. I'm not sure if it matters, but I'd consider the risk of a raspberry generating weak private keys.
https://seifried.org/lasg/encryption/In order for encryption to be effective, especially on a large scale such as IPSec across many hosts, good sources of random, cryptographically secure data are needed. In Linux we have /dev/random and /dev/urandom which are good but not always great. Part of the equation is measuring 'random' events, manipulating that data and then making it available (via (u)random). These random events include: keyboard and mouse input, interrupts, drive reads, etc.
However, as many servers have no keyboard/mouse, and onsider the risk of it cnew "blackbox" products often contain no harddrive, sources of random data become harder to find. Some sources, like network activity, are not entirely appropriate because the attacks may be able to measure it as well (granted this would be a very exotic attack, but enough to worry people nonetheless).
A raspberry should be able to use an SD card in the same way a computer uses a hard drive. In this instance, it seems there may be a problem with how random the operating system can actually be at generating addresses.
I don't know exactly how bitaddress.org generates its random. There's a discussion about it here, but I haven't looked into it further or reviewed the source code. Maybe it only uses human based mouse random input, but if it also collects random data from hard drives it's worth considering any risks. That particular issue discussed on github was that without mouse movement during the seeding the seed value was just the current time. It was fixed in 2013, but I don't know what additional sources of random they added since then, or if it only relies on mouse movements and the current time.
https://github.com/pointbiz/bitaddress.org/issues/35
You could always try producing 100 addresses and private keys to start with, wiping the pi and doing the same thing again.
If there are any anomalies this could be determined here (also check if the address has already been used might be a good idea as you know then that it isn't random).
I don't think producing 100 addresses is enough to test for anomalies. How would you test them?
NIST produced some software for conducting statistical testing on data produced by random number generators. However it requires compiling, and needs huge data sets to work with.
http://csrc.nist.gov/groups/ST/toolkit/rng/documents/SP800-22rev1a.pdfThis paper discusses some aspects of selecting and testing random and pseudorandom number generators.The outputs of such generators may be used in many cryptographic applications, such as the generation of key material. Generators suitable for use in cryptographic applications may need to meet stronger requirements than for other applications. In particular, their outputs must be unpredictable in the absence of knowledge of the inputs. Some criteria for characterizing and selecting appropriate generators are discussed in this document. The subject of statistical testing and its relation to cryptanalysis is also discussed, and some recommended statistical tests are provided. These tests may be useful as a first step in determining whether or not a generator is suitable for a particular cryptographic application. However,no set of statistical tests can absolutely certify a generator as appropriate for usage in a particular application, i.e., statistical testing cannot serve as a substitute for cryptanalysis
This is the download link for the the NIST Statistical Test Suite software.
http://csrc.nist.gov/groups/ST/toolkit/rng/documentation_software.htmlTesting if a sequence of numbers is random is incredibly difficult, as random.org points out.
https://www.random.org/analysis/If you flip enough coins, you will get sequences of coin flips that seen in isolation from the rest of the sequence don't look random at all. Scott Adams has drawn this as a Dilbert strip, which is funny exactly because it is true:
What Dilbert is told is correct: It is impossible to prove definitively whether a given sequence of numbers (and the generator that produced it) is random. It could happen that the creature in the comic strip has been generating perfectly random numbers for many years and that Dilbert simply happens to walk in at the moment when there's six nines in a row. It's not very likely, but if the creature sits there for long enough (and Dilbert visits enough times), then it will eventually happen.
There is more software for testing randomness called dieharder. It doesn't run all the NIST tests yet, but earlier software it's based on (called diehard) required a default input to work on of ten million random numbers in a file. Dieharder requires much more data than that to run sensitive tests.
http://www.phy.duke.edu/~rgb/General/dieharder.phpDieharder differs significantly from diehard in many ways. For example, diehard uses file based sources of random numbers exclusively and by default works with only roughly ten million random numbers in such a file. However, modern random number generators in a typical simulation application can easily need to generate 10^18 or more random numbers, generated from hundreds, thousands, millions of different seeds in independent (parallelized) simulation threads, as the application runs over a period of months to years. Those applications can easily be sensitive to rng weaknesses that might not be revealed by sequences as short as 10^7 uints in length even with excellent and sensitive tests. One of dieharder's primary design goals was to permit tests to be run on very long sequences.
*snip*
In addition to implementing all of the diehard tests it is expected that dieharder will eventually contain all of the NIST STS and a variety of tests contributed by users
There is definitely a problem of proving randomness of the data imported. I did just run a python program to produce 100000 numbers between zero to nine and it returned:
0: 9797
1: 9952
2: 10034
3: 10249
4: 9947
5: 9982
6: 9933
7: 9933
8: 10114
9: 9923
This was done on WINDOWS 7 and you can already spot a few anomalies that appear (0 and 3)
The code used was pretty simplistic (took about a minute to write
import random
numbers = [0,0,0,0,0,0,0,0,0,0]
for loop in range(100000):
n = random.randint(0,9)
numbers[n]+=1
print(numbers)
With a range of 100 numbers from 0 to 99:
[968, 952, 929, 1021, 999, 953, 1055, 1031, 1025, 1041, 1050, 1023, 1020, 1042, 1029, 964, 971, 974, 953, 946, 979, 1008, 1010, 1008, 1037, 1004, 939, 977, 974, 1004, 968, 975, 1005, 1025, 1020, 1010,
1038, 963, 1031, 958, 989, 980, 1011, 985, 1016, 1045, 999, 1002, 973, 1014, 1049, 976, 1025, 1030, 966, 981, 1013, 1007, 1033, 989, 988, 1017, 1013, 1009, 969, 1005, 1009, 937, 971, 980, 1018, 1005,
988, 987, 1000, 1028, 1007, 981, 1020, 1001, 932, 978, 1031, 999, 958, 1023, 996, 1030, 1030, 1059, 1025, 1015, 970, 997, 1029, 999, 990, 985, 1002, 1057]
I'd still say that 100000 is a little constraining with this idea...
I reran the code for selecting 10 numbers again and it returned:
[81583, 81809, 81464, 81847, 81529, 81790, 81536, 81104, 81295, 81521]
The problem with the randomness testing with the anomalies you suggested, there are fewer problems when looking at the overall statistic produced than if you look at them individually. For example, if you flip a coin continuously for a 12 hour period, you may eventually get several times where there are at least 12 continuous sides the same. but if you look at it generally, the result will be closer to 50% (probably, unless there are other errors).
There is also a problem that my computer may be not making random numbers as it is fairly evenly spread between each of the numbers that are there...
The analysis program on the .gov website attached above will be much better than my creations, mine is merely an example of probabilities.