Package net.tomp2p.storage

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


    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
    byte[] signature1 = factory.sign(keyPair1.getPrivate(), data.buffer()).encode();

    // decrypt signature to get hash of the object
    Cipher rsa = Cipher.getInstance("RSA");
    rsa.init(Cipher.DECRYPT_MODE, keyPair1.getPublic());
    byte[] hash = rsa.doFinal(signature1);
View Full Code Here


    Data testData = new Data("test");
    // create a content protection key
    KeyPair protectionKey = EncryptionUtil.generateRSAKeyPair();
   
    // sign the data
    SignatureCodec signature = signatureFactory.sign(protectionKey.getPrivate(), testData.buffer());
   
    // verify the data with the signature
    boolean isVerified = signatureFactory.verify(protectionKey.getPublic(), testData.buffer(), signature);
   
    // check if verifying worked
View Full Code Here

   
    // sign the data
    SignatureCodec signature = signatureFactory.sign(protectionKey.getPrivate(), testData.buffer());
   
    // verify the data with the signature
    boolean isVerified = signatureFactory.verify(protectionKey.getPublic(), testData.buffer(), signature);
   
    // check if verifying worked
    Assert.assertTrue(isVerified);
  }
 
View Full Code Here

    // create a content protection key
   
    KeyPairGenerator gen = KeyPairGenerator.getInstance("RSA");
    KeyPair protectionKey = gen.generateKeyPair();

    SignatureCodec signature = signatureFactory.sign(protectionKey.getPrivate(), testData.buffer());

    boolean isVerified = signatureFactory.verify(protectionKey.getPublic(), testData.buffer(), signature);

    Assert.assertTrue(isVerified);
  }
View Full Code Here

    KeyPairGenerator gen = KeyPairGenerator.getInstance("RSA");
    KeyPair protectionKey = gen.generateKeyPair();

    SignatureCodec signature = signatureFactory.sign(protectionKey.getPrivate(), testData.buffer());

    boolean isVerified = signatureFactory.verify(protectionKey.getPublic(), testData.buffer(), signature);

    Assert.assertTrue(isVerified);
  }
 
  @Test
View Full Code Here

            .keyPair(keyPairOld).start();
    futurePut.awaitUninterruptibly();
    Assert.assertTrue(futurePut.isSuccess());

    // create signature with old key pair having the data object
    byte[] signature1 = factory.sign(keyPairOld.getPrivate(), data.buffer()).encode();

    // decrypt signature to get hash of the object
    Cipher rsa = Cipher.getInstance("RSA");
    rsa.init(Cipher.DECRYPT_MODE, keyPairOld.getPublic());
    byte[] hash = rsa.doFinal(signature1);
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.