ContentObject extends GenericXMLEncodable implements XMLEncodable, Comparable<ContentObject>, ContentNameProvider { public byte [] digest() { if (_digest == null) _digest = calcDigest(); return _digest; } ContentObject(String digestAlgorithm, // prefer OID
			ContentName name,
			SignedInfo signedInfo,
			byte [] content,
			Signature signature
	);  ContentObject(String digestAlgorithm, // prefer OID
			ContentName name,
			SignedInfo signedInfo,
			byte [] content, int offset, int length,
			Signature signature);  ContentObject(String digestAlgorithm, // prefer OID
			ContentName name,
			SignedInfo signedInfo,
			InputStream contentStream, int length);  ContentObject(
			ContentName name,
			SignedInfo signedInfo,
			InputStream contentStream, int length);  ContentObject(ContentName name, SignedInfo signedInfo, byte [] content,
			Signature signature);  ContentObject(ContentName name, SignedInfo signedInfo, 
			byte [] content, int offset, int length,
			Signature signature);  ContentObject(ContentName name, 
			SignedInfo signedInfo,
			byte [] content, int offset, int length,
			Key signingKey);  ContentObject(ContentName name, 
			SignedInfo signedInfo,
			byte [] content, Key signingKey);  ContentObject(); static ContentObject buildContentObject(ContentName name, ContentType type, byte[] contents, 
			PublisherPublicKeyDigest publisher, KeyLocator locator,
			KeyManager keyManager, Integer freshnessSeconds, byte[] finalBlockID); static ContentObject buildContentObject(ContentName name, ContentType type, byte[] contents, 
			PublisherPublicKeyDigest publisher, KeyLocator locator,
			KeyManager keyManager, byte[] finalBlockID); static ContentObject buildContentObject(ContentName name, ContentType type, byte[] contents, 
			PublisherPublicKeyDigest publisher,
			KeyManager keyManager, byte[] finalBlockID); static ContentObject buildContentObject(ContentName name, byte[] contents, 
			PublisherPublicKeyDigest publisher,
			KeyManager keyManager, byte[] finalBlockID); static ContentObject buildContentObject(ContentName name, byte [] contents); static ContentObject buildContentObject(ContentName name, ContentType type, byte [] contents); static ContentObject buildContentObject(ContentName name, byte [] contents, PublisherPublicKeyDigest publisher); ContentObject clone(); final ContentName name(); final ContentName getContentName(); ContentName fullName(); final SignedInfo signedInfo(); final byte [] content(); final int contentLength(); final Signature signature(); void decode(XMLDecoder decoder); void encode(XMLEncoder encoder); @Override long getElementLabel(); @Override boolean validate(); @Override int hashCode(); @Override boolean equals(Object obj); void setSignature(Signature signature); void sign(Key signingKey); void sign(String digestAlgorithm, Key signingKey); static Signature sign(ContentName name, 
			SignedInfo signedInfo,
			byte [] content, int offset, int length,
			Key signingKey); static Signature sign(ContentName name, 
			SignedInfo signedInfo,
			byte [] content, int offset, int length,
			String digestAlgorithm, 
			Key signingKey); boolean verify(Key key); boolean verify(KeyManager keyManager); static boolean verify(ContentObject object,
								 Key key); static boolean verify(ContentObject object,
								 KeyManager keyManager); static boolean verify(
			ContentName name,
			SignedInfo signedInfo,
			byte [] content,
			Signature signature,
			Key key); static boolean verify(byte[] proxy, byte [] signature, SignedInfo signedInfo,
			String digestAlgorithm, Key key); static boolean verify(byte[] proxy, byte [] signature, SignedInfo signedInfo,
			String digestAlgorithm, KeyManager keyManager); byte [] computeProxy(); byte [] prepareContent(); static byte [] prepareContent(ContentName name, 
			SignedInfo signedInfo, 
			byte [] content); static byte [] prepareContent(final ContentName name, final SignedInfo signedInfo, final byte [] content, int start, int length); byte [] digest(); int compareTo(ContentObject o); boolean isType(ContentType type); boolean isData(); boolean isLink(); boolean isGone(); boolean isNACK(); boolean isKey(); String toString(); static boolean DEBUG_SIGNING; }
@Test public void testDigest() { Log.info(Log.FAC_TEST, "Starting testDigest"); try { ContentObject coempty = new ContentObject(name, auth, new byte[0], pair.getPrivate()); System.out.println("Created object with content of length " + coempty.contentLength() + " digest: " + DataUtils.printHexBytes(coempty.digest())); ContentObject coempty2 = new ContentObject(name, auth, null, pair.getPrivate()); System.out.println("Created another object with content of length " + coempty2.contentLength() + " digest: " + DataUtils.printHexBytes(coempty2.digest())); Assert.assertNotNull(coempty.digest()); Assert.assertArrayEquals(coempty.digest(), coempty2.digest()); } catch (Exception e) { Assert.fail("Exception in testEncDec: " + e.getClass().getName() + ": " + e.getMessage()); } Log.info(Log.FAC_TEST, "Completed testDigest"); }