Package org.hive2hive.core.model

Examples of org.hive2hive.core.model.UserPublicKey


          "The received content is not a user public key. Did not find the public key of user '{}'.",
          requestingUserId);
      throw new GetFailedException("Received unkown content.");
    } else {
      logger.trace("Successfully received the public key of user '{}'.", requestingUserId);
      UserPublicKey userPublicKey = (UserPublicKey) content;
      if (userPublicKey.getPublicKey() == null) {
        logger.error("User public key of user '{}' is corrupted.", requestingUserId);
        throw new GetFailedException("Received corrupted public key.");
      } else {
        logger.debug("Successfully got the public key of user '{}'.", userId);
        // store it in the cache
        publicKeyCache.put(requestingUserId, userPublicKey.getPublicKey());
        // return it
        return userPublicKey.getPublicKey();
      }
    }
  }
View Full Code Here


    // create and upload some fake public keys into the network
    Map<String, PublicKey> publicKeys = new HashMap<String, PublicKey>();
    for (int i = 0; i < random.nextInt(10); i++) {
      String userId = NetworkTestUtil.randomString();
      KeyPair key = EncryptionUtil.generateRSAKeyPair(H2HConstants.KEYLENGTH_USER_KEYS);
      UserPublicKey userPublicKey = new UserPublicKey(key.getPublic());
      Parameters parameters = new Parameters().setLocationKey(userId)
          .setContentKey(H2HConstants.USER_PUBLIC_KEY).setData(userPublicKey);
      network.get(random.nextInt(networkSize)).getDataManager().putUnblocked(parameters)
          .awaitUninterruptibly();
      publicKeys.put(userId, key.getPublic());
View Full Code Here

    Map<String, PublicKey> publicKeys = new HashMap<String, PublicKey>();
    for (int i = 0; i < random.nextInt(5); i++) {
      String userId = NetworkTestUtil.randomString();
      KeyPair key = EncryptionUtil.generateRSAKeyPair(H2HConstants.KEYLENGTH_USER_KEYS);
      UserPublicKey userPublicKey = new UserPublicKey(key.getPublic());
      Parameters parameters = new Parameters().setLocationKey(userId)
          .setContentKey(H2HConstants.USER_PUBLIC_KEY).setData(userPublicKey);
      network.get(random.nextInt(networkSize)).getDataManager().putUnblocked(parameters)
          .awaitUninterruptibly();
      publicKeys.put(userId, key.getPublic());
View Full Code Here

    // create and upload some fake public keys into the network
    Map<String, PublicKey> publicKeys = new HashMap<String, PublicKey>();
    for (int i = 0; i < 5; i++) {
      String userId = NetworkTestUtil.randomString();
      KeyPair key = EncryptionUtil.generateRSAKeyPair(H2HConstants.KEYLENGTH_USER_KEYS);
      UserPublicKey userPublicKey = new UserPublicKey(key.getPublic());
      Parameters parameters = new Parameters().setLocationKey(userId)
          .setContentKey(H2HConstants.USER_PUBLIC_KEY).setData(userPublicKey);
      network.get(random.nextInt(networkSize)).getDataManager().putUnblocked(parameters)
          .awaitUninterruptibly();
      publicKeys.put(userId, key.getPublic());
View Full Code Here

    FutureGet getKey = otherClient.getDataManager().getUnblocked(
        new Parameters().setLocationKey(credentials.getUserId()).setContentKey(
            H2HConstants.USER_PUBLIC_KEY));
    getKey.awaitUninterruptibly();
    getKey.getFutureRequests().awaitUninterruptibly();
    UserPublicKey publicKey = (UserPublicKey) getKey.getData().object();

    assertNotNull(publicKey);
  }
View Full Code Here

  @Override
  protected void doExecute() throws InvalidProcessStateException, ProcessExecutionException {
    UserProfile profile = context.consumeUserProfile();

    UserPublicKey publicKey = new UserPublicKey(profile.getEncryptionKeys().getPublic());
    try {
      put(profile.getUserId(), H2HConstants.USER_PUBLIC_KEY, publicKey, profile.getProtectionKeys());
    } catch (PutFailedException e) {
      throw new ProcessExecutionException(e);
    }
View Full Code Here

TOP

Related Classes of org.hive2hive.core.model.UserPublicKey

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.