public SignedBroadcastMessage(ParsedBroadcastMessage broadcastMessage, UserIdentity author) { this.parsedBroadcastMessage = broadcastMessage; this.author = author; try { signature = TrCrypto.sign(parsedBroadcastMessage, author.getPvtKey()); } catch (final Exception e) { throw new RuntimeException(e); } }
public static Tuple2<PrivateNodeId, RemoteNodeAddress> generate() { final Tuple2<RSAPublicKey, RSAPrivateKey> kp = TrCrypto.createRsaKeyPair(); final PrivateNodeId privateNodeId = new PrivateNodeId(); privateNodeId.privateKey = kp.b; final RemoteNodeAddress remoteNodeAddress = new RemoteNodeAddress(null, kp.a); return Tuple2.of(privateNodeId, remoteNodeAddress); }