/** * Get the payload carried by an I2P repliable datagram (previously loaded * with the loadI2PDatagram() method), verifying the datagram signature. * * @return A byte array containing the datagram payload * * @throws I2PInvalidDatagramException if the signature verification fails */ public byte[] getPayload() throws I2PInvalidDatagramException { this.verifySignature(); return this.extractPayload(); }
/** * Get the sender of an I2P repliable datagram (previously loaded with the * loadI2PDatagram() method), verifying the datagram signature. * * @return The Destination of the I2P repliable datagram sender * * @throws I2PInvalidDatagramException if the signature verification fails */ public Destination getSender() throws I2PInvalidDatagramException { this.verifySignature(); return this.extractSender(); }
/** * Extract the hash of the payload of an I2P repliable datagram (previously * loaded with the loadI2PDatagram() method), verifying the datagram * signature. * * As of 0.9.14, for signature types other than DSA_SHA1, this returns null. * * @return The hash of the payload of the I2P repliable datagram * @throws I2PInvalidDatagramException if the signature verification fails */ public Hash getHash() throws I2PInvalidDatagramException { // make sure it has a valid signature this.verifySignature(); return extractHash(); }
try { datagramDissector.loadI2PDatagram(msg); datagramDissector.verifySignature(); // TODO keep this line or remove it? byte[] payload = datagramDissector.extractPayload(); Destination sender = datagramDissector.getSender();