NodeKey { public NodeKey computeDescendantNodeKey(ContentName descendantNodeName, String keyLabel) throws InvalidKeyException, ContentEncodingException { if (nodeName().equals(descendantNodeName)) { if (Log.isLoggable(Log.FAC_ACCESSCONTROL, Level.INFO)) { Log.info(Log.FAC_ACCESSCONTROL,"Asked to compute ourselves as our own descendant (node key " + nodeName() +"), returning this."); } return this; } if (!nodeName().isPrefixOf(descendantNodeName)) { throw new IllegalArgumentException("Node " + descendantNodeName + " is not a child of this node " + nodeName()); } byte [] derivedKey = KeyDerivationFunction.DeriveKeyForNode(nodeName(), nodeKey().getEncoded(), keyLabel, descendantNodeName); return new NodeKey(descendantNodeName, derivedKey, storedNodeKeyName(), storedNodeKeyID()); } NodeKey(ContentName nodeKeyName, byte [] unwrappedNodeKey);  NodeKey(ContentName nodeKeyName, Key unwrappedNodeKey); protected  NodeKey(ContentName nodeName, byte [] derivedNodeKey, 
					  ContentName ancestorNodeKeyName, byte [] ancestorNodeKeyID); NodeKey computeDescendantNodeKey(ContentName descendantNodeName, String keyLabel); NodeKey computeDescendantNodeKey(ContentName descendantNodeName); ContentName nodeName(); ContentName storedNodeKeyName(); byte [] storedNodeKeyID(); Key nodeKey(); boolean isDerivedNodeKey(); boolean isNullNodeKey(); static byte [] nullNodeKeyID(); CCNTime nodeKeyVersion(); byte [] generateKeyID(); static byte [] generateKeyID(byte [] key); static byte [] generateKeyID(Key key); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(); static final int DEFAULT_NODE_KEY_LENGTH; static final String DEFAULT_NODE_KEY_ALGORITHM; static final String DEFAULT_KEY_LABEL; static final byte [] NULL_NODE_KEY_ID; }
@Test public void testComputeDescendantNodeKey() throws Exception { Log.info(Log.FAC_TEST, "Starting testComputeDescendantNodeKey"); byte[] aKeyBytes = descendantNodeKey3.nodeKey().getEncoded(); byte[] bKeyBytes = descendantNodeKey2.nodeKey().getEncoded(); System.out.println(Arrays.hashCode(aKeyBytes)); System.out.println(Arrays.hashCode(bKeyBytes)); System.out.println(testNodeKey.nodeKeyVersion()); System.out.println(descendantNodeKey1.nodeKeyVersion()); System.out.println(descendantNodeKey2.nodeKeyVersion()); System.out.println(descendantNodeKey3.nodeKeyVersion()); System.out.println(testNodeKey.storedNodeKeyName()); System.out.println(descendantNodeKey1.storedNodeKeyName()); System.out.println(descendantNodeKey2.storedNodeKeyName()); System.out.println(descendantNodeKey3.storedNodeKeyName()); System.out.println(Arrays.hashCode(testNodeKey.generateKeyID())); System.out.println(Arrays.hashCode(descendantNodeKey1.generateKeyID())); System.out.println(Arrays.hashCode(descendantNodeKey2.generateKeyID())); System.out.println(Arrays.hashCode(descendantNodeKey3.generateKeyID())); System.out.println(Arrays.hashCode(testNodeKey.storedNodeKeyID())); System.out.println(Arrays.hashCode(descendantNodeKey1.storedNodeKeyID())); System.out.println(Arrays.hashCode(descendantNodeKey2.storedNodeKeyID())); System.out.println(Arrays.hashCode(descendantNodeKey3.storedNodeKeyID())); Assert.assertArrayEquals(aKeyBytes, bKeyBytes); Log.info(Log.FAC_TEST, "Completed testComputeDescendantNodeKey"); }