Examples of ttlSeconds()


Examples of net.tomp2p.storage.Data.ttlSeconds()

  public FuturePut putUnblocked(IParameters parameters) {
    logger.debug("Put. {}", parameters.toString());
    try {
      Data data = new Data(parameters.getData());
      data.ttlSeconds(parameters.getTTL()).basedOn(parameters.getData().getBasedOnKey());

      // check if data to put is content protected
      if (parameters.getProtectionKeys() != null) {
        data.setProtectedEntry().publicKey(parameters.getProtectionKeys().getPublic());
View Full Code Here

Examples of net.tomp2p.storage.Data.ttlSeconds()

    // create dummy object to change the protection key
    Data data = new Data().setProtectedEntry();
    // set new content protection keys
    data.publicKey(parameters.getNewProtectionKeys().getPublic());
    if (parameters.getTTL() != -1)
      data.ttlSeconds(parameters.getTTL());

    // // sign the data
    // try {
    // // encrypt hash with new key pair to get the new signature (without having the data object)
    // Cipher rsa = Cipher.getInstance("RSA");
View Full Code Here

Examples of net.tomp2p.storage.Data.ttlSeconds()

    // verify that data signature is still the same
    Assert.assertTrue(retData.verify(keyPair1.getPublic(), factory));

    // try to overwrite with wrong protection keys 2 and without data signature (expected to fail)
    data = new Data("dataD").setProtectedEntry();
    data.ttlSeconds(ttl).basedOn(bKey).sign(keyPair1, factory);
    // put using wrong content protection keys 2 to sign message
    futureTryOverwrite = p1.put(lKey).setDomainKey(dKey).setData(cKey, data).setVersionKey(vKey)
        .keyPair(keyPair2).start();
    futureTryOverwrite.awaitUninterruptibly();
    Assert.assertFalse(futureTryOverwrite.isSuccess());
View Full Code Here

Examples of net.tomp2p.storage.Data.ttlSeconds()

    // verify new data signature
    Assert.assertTrue(retData.verify(keyPair2.getPublic(), factory));

    // overwrite with content protection key 1 and data signature
    data = new Data("data4").setProtectedEntry();
    data.ttlSeconds(ttl).basedOn(bKey).sign(keyPair1, factory);
    // put using content content protection key 1 to sign message
    FuturePut futureOverwrite3 = p1.put(lKey).setDomainKey(dKey).setData(cKey, data).setVersionKey(vKey)
        .keyPair(keyPair1).start();
    futureOverwrite3.awaitUninterruptibly();
    Assert.assertTrue(futureOverwrite3.isSuccess());
View Full Code Here

Examples of net.tomp2p.storage.Data.ttlSeconds()

    Number160 bKey = Number160.createHash("based on");
    int ttl = 10;

    // initial put with data signature and entry protection
    Data data = new Data("data1").setProtectedEntry();
    data.ttlSeconds(ttl).basedOn(bKey).sign(keyPair1, factory);
    // put using content protection key 1 to sign message
    FuturePut futureIntialPut = p1.put(lKey).setDomainKey(dKey).setData(cKey, data).setVersionKey(vKey)
        .keyPair(keyPair1).start();
    futureIntialPut.awaitUninterruptibly();
    Assert.assertTrue(futureIntialPut.isSuccess());
View Full Code Here

Examples of net.tomp2p.storage.Data.ttlSeconds()

    Number160 bKey = Number160.createHash("based on");
    int ttl = 10;

    // initial put with data signature and entry protection
    Data data = new Data("data1").setProtectedEntry();
    data.ttlSeconds(ttl).basedOn(bKey).sign(keyPair1, factory);
    // put using content protection key 1 to sign message
    FuturePut futureIntialPut = p1.put(lKey).setDomainKey(dKey).setData(cKey, data).setVersionKey(vKey)
        .keyPair(keyPair1).start();
    futureIntialPut.awaitUninterruptibly();
    Assert.assertTrue(futureIntialPut.isSuccess());
View Full Code Here

Examples of net.tomp2p.storage.Data.ttlSeconds()

    Number160 vKey = Number160.createHash("version");
    Number160 bKey = Number160.createHash("based on");

    String testData = "data";
    Data data = new Data(testData).setProtectedEntry().sign(keyPair, factory);
    data.ttlSeconds(10000).basedOn(bKey);

    FuturePut futurePut1 = p1.put(lKey).setData(cKey, data).setDomainKey(dKey).setVersionKey(vKey)
        .keyPair(keyPair).start();
    futurePut1.awaitUninterruptibly();
    assertTrue(futurePut1.isSuccess());
View Full Code Here

Examples of net.tomp2p.storage.Data.ttlSeconds()

    Number160 bKey = Number160.createHash("based on");
    int ttl = 10;

    // initial put with keys 1 and data signature
    Data data = new Data("data").sign(keyPair1, factory);
    data.ttlSeconds(ttl).basedOn(bKey);
    FuturePut futurePut = p1.put(lKey).setDomainKey(dKey).setData(cKey, data).setVersionKey(vKey).start();
    futurePut.awaitUninterruptibly();
    Assert.assertTrue(futurePut.isSuccess());

    // create signature with keys 1 having the data object
View Full Code Here

Examples of net.tomp2p.storage.Data.ttlSeconds()

    Number160 bKey = Number160.createHash("based on");
    int ttl = 10;

    // initial put with data signature and entry protection
    Data intialData = new Data("data").setProtectedEntry();
    intialData.ttlSeconds(ttl).basedOn(bKey).sign(keyPair1, factory);
    // put using content protection key 1 to sign message
    FuturePut futureIntialPut = p1.put(lKey).setDomainKey(dKey).setData(cKey, intialData)
        .setVersionKey(vKey).keyPair(keyPair1).start();
    futureIntialPut.awaitUninterruptibly();
    Assert.assertTrue(futureIntialPut.isSuccess());
View Full Code Here

Examples of net.tomp2p.storage.Data.ttlSeconds()

    // verify data signature
    Assert.assertTrue(retData.verify(keyPair1.getPublic(), factory));

    // try to overwrite without content protection and data signature (expected to fail)
    Data data = new Data("dataA");
    data.ttlSeconds(ttl).basedOn(bKey).sign(keyPair1, factory);
    // put using content protection key 1 to sign message
    FuturePut futureTryOverwrite = p1.put(lKey).setDomainKey(dKey).setData(cKey, data)
        .setVersionKey(vKey).start();
    futureTryOverwrite.awaitUninterruptibly();
    Assert.assertFalse(futureTryOverwrite.isSuccess());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.