Package freenet.keys

Examples of freenet.keys.InsertableClientSSK.encode()


    String docName = "myDOC";
    InsertableClientSSK ik = new InsertableClientSSK(docName, pkHash, pubKey, privKey, ckey, Key.ALGO_AES_PCFB_256_SHA256);
   
    String test = "test";
    SimpleReadOnlyArrayBucket bucket = new SimpleReadOnlyArrayBucket(test.getBytes("UTF-8"));
    ClientSSKBlock block = ik.encode(bucket, false, false, (short)-1, bucket.size(), random, Compressor.DEFAULT_COMPRESSORDESCRIPTOR, false);
    SSKBlock sskBlock = (SSKBlock) block.getBlock();
    store.put(sskBlock, false, false);
   
    //If the block is the same then there should not be a collision
    try {
View Full Code Here


     
    }
   
    String test1 = "test1";
    SimpleReadOnlyArrayBucket bucket1 = new SimpleReadOnlyArrayBucket(test1.getBytes("UTF-8"));
    ClientSSKBlock block1 = ik.encode(bucket1, false, false, (short)-1, bucket1.size(), random, Compressor.DEFAULT_COMPRESSORDESCRIPTOR, false);
    SSKBlock sskBlock1 = (SSKBlock) block1.getBlock();
   
    //if it's different (e.g. different content, same key), there should be a KCE thrown
    try {
      store.put(sskBlock1, false, false);
View Full Code Here

  private ClientSSKBlock encodeBlockSSK(String test, RandomSource random) throws IOException, SSKEncodeException, InvalidCompressionCodecException {
    byte[] data = test.getBytes("UTF-8");
    SimpleReadOnlyArrayBucket bucket = new SimpleReadOnlyArrayBucket(data);
    InsertableClientSSK ik = InsertableClientSSK.createRandom(random, test);
    return ik.encode(bucket, false, false, (short)-1, bucket.size(), random, Compressor.DEFAULT_COMPRESSORDESCRIPTOR, false);
  }
}
View Full Code Here

    String docName = "myDOC";
    InsertableClientSSK ik = new InsertableClientSSK(docName, pkHash, pubKey, privKey, ckey, Key.ALGO_AES_PCFB_256_SHA256);
   
    String test = "test";
    SimpleReadOnlyArrayBucket bucket = new SimpleReadOnlyArrayBucket(test.getBytes("UTF-8"));
    ClientSSKBlock block = ik.encode(bucket, false, false, (short)-1, bucket.size(), random, Compressor.DEFAULT_COMPRESSORDESCRIPTOR, false);
    SSKBlock sskBlock = (SSKBlock) block.getBlock();
    store.put(sskBlock, false, false);
   
    //If the block is the same then there should not be a collision
    try {
View Full Code Here

     
    }
   
    String test1 = "test1";
    SimpleReadOnlyArrayBucket bucket1 = new SimpleReadOnlyArrayBucket(test1.getBytes("UTF-8"));
    ClientSSKBlock block1 = ik.encode(bucket1, false, false, (short)-1, bucket1.size(), random, Compressor.DEFAULT_COMPRESSORDESCRIPTOR, false);
    SSKBlock sskBlock1 = (SSKBlock) block1.getBlock();
   
    //if it's different (e.g. different content, same key), there should be a KCE thrown
    try {
      store.put(sskBlock1, false, false);
View Full Code Here

  private ClientSSKBlock encodeBlockSSK(String test, RandomSource random) throws IOException, SSKEncodeException, InvalidCompressionCodecException {
    byte[] data = test.getBytes("UTF-8");
    SimpleReadOnlyArrayBucket bucket = new SimpleReadOnlyArrayBucket(data);
    InsertableClientSSK ik = InsertableClientSSK.createRandom(random, test);
    return ik.encode(bucket, false, false, (short)-1, bucket.size(), random, Compressor.DEFAULT_COMPRESSORDESCRIPTOR, false);
  }
}
View Full Code Here

    String uriType = uri.getKeyType();
    if(uriType.equals("CHK")) {
      return ClientCHKBlock.encode(sourceData, isMetadata, compressionCodec == -1, compressionCodec, sourceLength, compressorDescriptor, pre1254, cryptoKey, cryptoAlgorithm);
    } else if(uriType.equals("SSK") || uriType.equals("KSK")) {
      InsertableClientSSK ik = InsertableClientSSK.create(uri);
      return ik.encode(sourceData, isMetadata, compressionCodec == -1, compressionCodec, sourceLength, random, compressorDescriptor, pre1254);
    } else {
      throw new InsertException(InsertExceptionMode.INVALID_URI, "Unknown keytype "+uriType, null);
    }
  }
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.