Class SSU2Util


  • final class SSU2Util
    extends Object
    SSU2 Utils and constants
    Since:
    0.9.54
    • Method Detail

      • hkdf

        public static byte[] hkdf​(I2PAppContext ctx,
                                  byte[] key,
                                  String info)
        32 byte output, ZEROLEN data
      • createPeerTestData

        public static byte[] createPeerTestData​(I2PAppContext ctx,
                                                Hash h,
                                                Hash h2,
                                                PeerTestState.Role role,
                                                long nonce,
                                                byte[] ip,
                                                int port,
                                                SigningPrivateKey spk)
        Make the data for the peer test block
        Parameters:
        h - to be included in sig, not included in data
        h2 - may be null, to be included in sig, not included in data
        ip - may be null
        Returns:
        null on failure
      • sign

        public static Signature sign​(I2PAppContext ctx,
                                     byte[] prologue,
                                     Hash h,
                                     Hash h2,
                                     byte[] data,
                                     int datalen,
                                     SigningPrivateKey spk)
        Sign the relay or peer test data, using the prologue and hash as the initial data, and then the provided data.
        Parameters:
        data - if desired, leave room at end for sig
        datalen - the length of the data to be signed
        h - to be included in sig, not included in data
        h2 - may be null, to be included in sig, not included in data
        Returns:
        null on failure
      • validateSig

        public static boolean validateSig​(I2PAppContext ctx,
                                          byte[] prologue,
                                          Hash h,
                                          Hash h2,
                                          byte[] data,
                                          SigningPublicKey spk)
        Validate the signed relay or peer test data, using the prologue and hash as the initial data, and then the provided data which ends with a signature of the specified type.
        Parameters:
        h2 - may be null