public static ClientKeyBlock createKeyBlock(ClientKey key, KeyBlock block) throws KeyVerifyException { if(key instanceof ClientSSK) return ClientSSKBlock.construct((SSKBlock)block, (ClientSSK)key); else //if(key instanceof ClientCHK return new ClientCHKBlock((CHKBlock)block, (ClientCHK)key); }
public ClientSSKBlock decode(SSKBlock block, long edition) throws SSKVerifyException { ClientSSK csk = origUSK.getSSK(edition); assert(Arrays.equals(csk.ehDocname, block.getKey().getKeyBytes())); return ClientSSKBlock.construct(block, csk); }
private String decodeBlockSSK(SSKBlock verify, ClientSSK key) throws SSKVerifyException, KeyDecodeException, IOException { ClientSSKBlock cb = ClientSSKBlock.construct(verify, key); Bucket output = cb.decode(new ArrayBucketFactory(), 32768, false); byte[] buf = BucketTools.toByteArray(output); return new String(buf, "UTF-8"); }
private String decodeBlockSSK(SSKBlock verify, ClientSSK key) throws SSKVerifyException, KeyDecodeException, IOException { ClientSSKBlock cb = ClientSSKBlock.construct(verify, key); Bucket output = cb.decode(new ArrayBucketFactory(), 32768, false); byte[] buf = BucketTools.toByteArray(output); return new String(buf, "UTF-8"); }
public ClientKeyBlock fetch(ClientSSK clientSSK, boolean canReadClientCache, boolean canWriteClientCache, boolean canWriteDatastore) throws SSKVerifyException { DSAPublicKey key = clientSSK.getPubKey(); if(key == null) { key = getPubKey.getKey(clientSSK.pubKeyHash, canReadClientCache, false, null); } if(key == null) return null; clientSSK.setPublicKey(key); SSKBlock block = fetch((NodeSSK)clientSSK.getNodeKey(true), false, canReadClientCache, canWriteClientCache, canWriteDatastore, false, null); if(block == null) { if(logMINOR) Logger.minor(this, "Could not find key for "+clientSSK); return null; } // Move the pubkey to the top of the LRU, and fix it if it // was corrupt. getPubKey.cacheKey(clientSSK.pubKeyHash, key, false, canWriteClientCache, canWriteDatastore, false, writeLocalToDatastore); return ClientSSKBlock.construct(block, clientSSK); }
ClientSSKBlock collided = ClientSSKBlock.construct(((SSKBlock)e.getCollidedBlock()), (ClientSSK)k); byte[] data = collided.memoryDecode(true); byte[] inserting = BucketTools.toByteArray(block.copyBucket);
SSKBlock block = (SSKBlock) o; key.setPublicKey(block.getPubKey()); return ClientSSKBlock.construct(block, key); } catch(SSKVerifyException e) { Logger.error(this, "Does not verify: " + e, e); SSKBlock block = rs.getSSKBlock(); key.setPublicKey(block.getPubKey()); return ClientSSKBlock.construct(block, key); } catch(SSKVerifyException e) { Logger.error(this, "Does not verify: " + e, e);