Package net.tomp2p.message

Examples of net.tomp2p.message.SignatureCodec.decode()


    }

    byte[] signatureData = signature.sign();

    SignatureCodec decodedSignature = new H2HSignatureCodec();
    decodedSignature.decode(signatureData);
    return decodedSignature;
  }

  @Override
  public boolean verify(PublicKey publicKey, ByteBuf buf, SignatureCodec signatureEncoded) throws SignatureException,
View Full Code Here


    // verify data signature
    Assert.assertTrue(p1.get(lKey).setDomainKey(dKey).setContentKey(cKey).setVersionKey(vKey).start()
        .awaitUninterruptibly().getData().verify(keyPair1.getPublic(), factory));

    // change data signature to keys 2, assign the reused hash from signature
    data = new Data().ttlSeconds(ttl).signature(codec.decode(signatureNew));
    // don't forget to set signed flag, create meta data
    data.signed(true).duplicateMeta();
    FuturePut futurePutMeta = p1.put(lKey).setDomainKey(dKey).putMeta().setData(cKey, data)
        .setVersionKey(vKey).start();
    futurePutMeta.awaitUninterruptibly();
View Full Code Here

    rsa = Cipher.getInstance("RSA");
    rsa.init(Cipher.ENCRYPT_MODE, keyPair2.getPrivate());
    byte[] signatureNew = rsa.doFinal(hash);

    // change data signature to keys 2, assign the reused hash from signature
    data = new Data().ttlSeconds(ttl).signature(codec.decode(signatureNew)).setProtectedEntry();
    // don't forget to set signed flag, create meta data
    data.signed(true).duplicateMeta();
    // put meta using content content protection key 1 to sign message
    FuturePut futurePutMeta = p1.put(lKey).setDomainKey(dKey).putMeta().setData(cKey, data)
        .setVersionKey(vKey).keyPair(keyPair1).start();
View Full Code Here

    rsa = Cipher.getInstance("RSA");
    rsa.init(Cipher.ENCRYPT_MODE, keyPair2.getPrivate());
    byte[] signatureNew = rsa.doFinal(hash);

    // change data signature to keys 2, assign the reused hash from signature
    data = new Data().ttlSeconds(ttl).signature(codec.decode(signatureNew)).setProtectedEntry();
    // don't forget to set signed flag
    data.signed(true);
    // change the content protection keys to 2
    data.publicKey(keyPair2.getPublic());
    // create meta data
View Full Code Here

      signature.update(buffer);
    }
    byte[] signatureData = signature.sign();

    SignatureCodec decodedSignature = new DSASignatureCodec();
    decodedSignature.decode(signatureData);
    return decodedSignature;
  }

  @Override
  public boolean verify(PublicKey publicKey, ByteBuf buf, SignatureCodec signatureEncoded)
View Full Code Here

    // through a put meta
    Data dummyData = new Data();
    dummyData.addBasedOn(bKey).ttlSeconds(ttl);
    // assign the reused hash from signature (don't forget to set the
    // signedflag)
    dummyData.signature(codec.decode(signatureNew)).signed(true).duplicateMeta();
    // change content protection key through a put meta
    FuturePut futurePutMeta = p1.put(lKey).domainKey(dKey).putMeta().data(cKey, dummyData)
            .versionKey(vKey).keyPair(keyPairOld).start();
    futurePutMeta.awaitUninterruptibly();
    Assert.assertTrue(futurePutMeta.isSuccess());
View Full Code Here

    }
   
    byte[] signatureData = signature.sign();

    SignatureCodec decodedSignature = new RSASignatureCodec();
    decodedSignature.decode(signatureData);
    return decodedSignature;
  }

  @Override
  public boolean verify(PublicKey publicKey, ByteBuf buf, SignatureCodec signatureEncoded)
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.