1 package civitas.crypto.sharedkey;
2
3 import java.io.BufferedReader;
4 import java.io.IOException;
5 import java.util.Base64;
6
7 import org.springframework.beans.factory.annotation.Autowired;
8 import org.springframework.stereotype.Controller;
9
10 @Controller
11 public class SharedKeyFromWire {
12 @Autowired
13 CreateSharedKeyFromBytes createSharedKeyFromBytes;
14
15 public SharedKey apply(final BufferedReader br) throws IOException {
16 String name = br.readLine();
17 String s = br.readLine();
18 byte[] bs = Base64.getDecoder().decode(s);
19 return new SharedKey(createSharedKeyFromBytes.apply(bs), name);
20 }
21 }