Commit d242a2aa authored by Karsten Loesing's avatar Karsten Loesing
Browse files

Add descriptor digest to vote and streamline method names.

Implements #20333.
parent 2187c711
......@@ -6,10 +6,12 @@
- Add support for six new key-value pairs added by OnionPerf.
- Fix a bug where DescriptorIndexCollector would not delete
extraneous local files if remote paths start with /.
- Add previously missing method to obtain the digest of a vote.
* Minor changes
- Accept extra arguments in statistics-related extra-info
descriptor lines, as permitted by dir-spec.txt.
- Streamline digest method names.
# Changes in version 1.6.0 - 2017-02-17
......
......@@ -89,8 +89,18 @@ public interface DirSourceEntry {
* Return the SHA-1 vote digest, encoded as 40 lower-case hexadecimal
* characters.
*
* @deprecated Renamed to {@link #getVoteDigestSha1Hex()}.
*
* @since 1.0.0
*/
public String getVoteDigest();
/**
* Return the SHA-1 vote digest, encoded as 40 lower-case hexadecimal
* characters.
*
* @since 1.7.0
*/
public String getVoteDigestSha1Hex();
}
......@@ -102,8 +102,18 @@ public interface DirectoryKeyCertificate extends Descriptor {
* Return the SHA-1 certificate digest, encoded as 40 lower-case
* hexadecimal characters.
*
* @deprecated Renamed to {@link #getDigestSha1Hex()}.
*
* @since 1.0.0
*/
public String getCertificateDigest();
/**
* Return the SHA-1 certificate digest, encoded as 40 lower-case
* hexadecimal characters.
*
* @since 1.7.0
*/
public String getDigestSha1Hex();
}
......@@ -37,10 +37,21 @@ public interface DirectorySignature {
* in the version 3 directory protocol, encoded as 40 upper-case
* hexadecimal characters.
*
* @deprecated Renamed to {@link #getSigningKeyDigestSha1Hex()}.
*
* @since 1.0.0
*/
public String getSigningKeyDigest();
/**
* Return the SHA-1 digest of the authority's medium-term signing key
* in the version 3 directory protocol, encoded as 40 upper-case
* hexadecimal characters.
*
* @since 1.7.0
*/
public String getSigningKeyDigestSha1Hex();
/**
* Return the directory signature string made with the authority's
* identity key in the version 3 directory protocol.
......
......@@ -48,19 +48,42 @@ public interface ExtraInfoDescriptor extends Descriptor {
* characters, that is used to reference this descriptor from a server
* descriptor.
*
* @deprecated Renamed to {@link #getDigestSha1Hex()}.
*
* @since 1.0.0
*/
public String getExtraInfoDigest();
/**
* Return the SHA-1 descriptor digest, encoded as 40 lower-case (relay
* descriptors) or upper-case (bridge descriptors) hexadecimal
* characters, that is used to reference this descriptor from a server
* descriptor.
*
* @since 1.7.0
*/
public String getDigestSha1Hex();
/**
* Return the SHA-256 descriptor digest, encoded as 43 base64
* characters without padding characters, that may be used to reference
* this descriptor from a server descriptor.
*
* @deprecated Renamed to {@link #getDigestSha256Base64()}.
*
* @since 1.1.0
*/
public String getExtraInfoDigestSha256();
/**
* Return the SHA-256 descriptor digest, encoded as 43 base64
* characters without padding characters, that may be used to reference
* this descriptor from a server descriptor.
*
* @since 1.7.0
*/
public String getDigestSha256Base64();
/**
* Return the server's nickname consisting of 1 to 19 alphanumeric
* characters.
......@@ -112,20 +135,44 @@ public interface ExtraInfoDescriptor extends Descriptor {
* upper-case hexadecimal characters, or null if no GeoIP database
* digest is included.
*
* @deprecated Renamed to {@link #getGeoipDbDigestSha1Hex()}.
*
* @since 1.0.0
*/
public String getGeoipDbDigest();
/**
* Return a SHA-1 digest of the GeoIP database file used by this server
* to resolve client IP addresses to country codes, encoded as 40
* upper-case hexadecimal characters, or null if no GeoIP database
* digest is included.
*
* @since 1.7.0
*/
public String getGeoipDbDigestSha1Hex();
/**
* Return a SHA-1 digest of the GeoIPv6 database file used by this
* server to resolve client IP addresses to country codes, encoded as 40
* upper-case hexadecimal characters, or null if no GeoIPv6 database
* digest is included.
*
* @deprecated Renamed to {@link #getGeoip6DbDigestSha1Hex()}.
*
* @since 1.0.0
*/
public String getGeoip6DbDigest();
/**
* Return a SHA-1 digest of the GeoIPv6 database file used by this
* server to resolve client IP addresses to country codes, encoded as 40
* upper-case hexadecimal characters, or null if no GeoIPv6 database
* digest is included.
*
* @since 1.7.0
*/
public String getGeoip6DbDigestSha1Hex();
/**
* Return the time in milliseconds since the epoch when the included
* directory request statistics interval ended, or -1 if no such
......
......@@ -28,10 +28,21 @@ public interface Microdescriptor extends Descriptor {
* characters without padding characters, that is used to reference this
* descriptor from a vote or microdescriptor consensus.
*
* @deprecated Renamed to {@link #getDigestSha256Base64()}.
*
* @since 1.0.0
*/
public String getMicrodescriptorDigest();
/**
* Return the SHA-256 descriptor digest, encoded as 43 base64
* characters without padding characters, that is used to reference this
* descriptor from a vote or microdescriptor consensus.
*
* @since 1.7.0
*/
public String getDigestSha256Base64();
/**
* Return the RSA-1024 public key in PEM format used to encrypt CREATE
* cells for this server, or null if the descriptor doesn't contain an
......
......@@ -93,10 +93,21 @@ public interface NetworkStatusEntry {
* containing network status is a vote or microdesc consensus, or null
* otherwise.
*
* @deprecated Renamed to {@link #getMicrodescriptorDigestsSha256Base64()}.
*
* @since 1.0.0
*/
public Set<String> getMicrodescriptorDigests();
/**
* Return the (possibly empty) set of microdescriptor digests if the
* containing network status is a vote or microdesc consensus, or null
* otherwise.
*
* @since 1.7.0
*/
public Set<String> getMicrodescriptorDigestsSha256Base64();
/**
* Return additional IP addresses and TCP ports where this server
* accepts TLS connections for the main OR protocol, or an empty list if
......
......@@ -97,8 +97,19 @@ public interface RelayDirectory extends Descriptor {
* hexadecimal characters, that the directory authority used to sign the
* directory.
*
* @deprecated Renamed to {@link #getDigestSha1Hex()}.
*
* @since 1.0.0
*/
public String getDirectoryDigest();
/**
* Return the SHA-1 directory digest, encoded as 40 lower-case
* hexadecimal characters, that the directory authority used to sign the
* directory.
*
* @since 1.7.0
*/
public String getDigestSha1Hex();
}
......@@ -169,8 +169,19 @@ public interface RelayNetworkStatus extends Descriptor {
* characters, that the directory authority used to sign the network
* status.
*
* @deprecated Renamed to {@link #getDigestSha1Hex()}.
*
* @since 1.0.0
*/
public String getStatusDigest();
/**
* Return the SHA-1 status digest, encoded as 40 lower-case hexadecimal
* characters, that the directory authority used to sign the network
* status.
*
* @since 1.7.0
*/
public String getDigestSha1Hex();
}
......@@ -282,12 +282,23 @@ public interface RelayNetworkStatusConsensus extends Descriptor {
public SortedMap<String, Integer> getBandwidthWeights();
/**
* Return the SHA-1 digest of this consensus, encoded as 40 upper-case
* Return the SHA-1 digest of this consensus, encoded as 40 lower-case
* hexadecimal characters that directory authorities use to sign the
* consensus.
*
* @deprecated Renamed to {@link #getDigestSha1Hex()}.
*
* @since 1.0.0
*/
public String getConsensusDigest();
/**
* Return the SHA-1 digest of this consensus, encoded as 40 lower-case
* hexadecimal characters that directory authorities use to sign the
* consensus.
*
* @since 1.7.0
*/
public String getDigestSha1Hex();
}
......@@ -415,7 +415,7 @@ public interface RelayNetworkStatusVote extends Descriptor {
* @deprecated Removed in order to be more explicit that authorities may
* use different digest algorithms than "sha1"; see
* {@link #getSignatures()} and
* {@link DirectorySignature#getSigningKeyDigest()} for
* {@link DirectorySignature#getSigningKeyDigestSha1Hex()} for
* alternatives.
*
* @since 1.0.0
......@@ -491,5 +491,13 @@ public interface RelayNetworkStatusVote extends Descriptor {
* @since 1.3.0
*/
public List<DirectorySignature> getSignatures();
/**
* Return the SHA-1 digest of this vote, encoded as 40 lower-case hexadecimal
* characters that is used to reference this vote from a consensus.
*
* @since 1.7.0
*/
public String getDigestSha1Hex();
}
......@@ -51,19 +51,42 @@ public interface ServerDescriptor extends Descriptor {
* characters, that is used to reference this descriptor from a network
* status descriptor.
*
* @deprecated Renamed to {@link #getDigestSha1Hex()}.
*
* @since 1.0.0
*/
public String getServerDescriptorDigest();
/**
* Return the SHA-1 descriptor digest, encoded as 40 lower-case (relay
* descriptors) or upper-case (bridge descriptors) hexadecimal
* characters, that is used to reference this descriptor from a network
* status descriptor.
*
* @since 1.7.0
*/
public String getDigestSha1Hex();
/**
* Return the SHA-256 descriptor digest, encoded as 43 base64
* characters without padding characters, that may be used to reference
* this server descriptor from a network status descriptor.
*
* @deprecated Renamed to {@link #getDigestSha256Base64()}.
*
* @since 1.1.0
*/
public String getServerDescriptorDigestSha256();
/**
* Return the SHA-256 descriptor digest, encoded as 43 base64
* characters without padding characters, that may be used to reference
* this server descriptor from a network status descriptor.
*
* @since 1.7.0
*/
public String getDigestSha256Base64();
/**
* Return the server's nickname consisting of 1 to 19 alphanumeric
* characters.
......@@ -299,20 +322,43 @@ public interface ServerDescriptor extends Descriptor {
* encoded as 40 upper-case hexadecimal characters, or null if the
* server did not upload a corresponding extra-info descriptor.
*
* @deprecated Renamed to {@link #getExtraInfoDigestSha1Hex()}.
*
* @since 1.0.0
*/
public String getExtraInfoDigest();
/**
* Return the SHA-1 digest of the server's extra-info descriptor,
* encoded as 40 upper-case hexadecimal characters, or null if the
* server did not upload a corresponding extra-info descriptor.
*
* @since 1.7.0
*/
public String getExtraInfoDigestSha1Hex();
/**
* Return the SHA-256 digest of the server's extra-info descriptor,
* encoded as 43 base64 characters without padding characters, or null
* if the server either did not upload a corresponding extra-info
* descriptor or did not refer to it using a SHA-256 digest.
*
* @deprecated Renamed to {@link #getExtraInfoDigestSha256Base64()}.
*
* @since 1.1.0
*/
public String getExtraInfoDigestSha256();
/**
* Return the SHA-256 digest of the server's extra-info descriptor,
* encoded as 43 base64 characters without padding characters, or null
* if the server either did not upload a corresponding extra-info
* descriptor or did not refer to it using a SHA-256 digest.
*
* @since 1.7.0
*/
public String getExtraInfoDigestSha256Base64();
/**
* Return the list of hidden service descriptor version numbers that
* this server stores and serves, or null if it doesn't store and serve
......
......@@ -228,6 +228,11 @@ public class DirSourceEntryImpl implements DirSourceEntry {
@Override
public String getVoteDigest() {
return this.getVoteDigestSha1Hex();
}
@Override
public String getVoteDigestSha1Hex() {
return this.voteDigest;
}
}
......
......@@ -312,6 +312,11 @@ public class DirectoryKeyCertificateImpl extends DescriptorImpl
@Override
public String getCertificateDigest() {
return this.getDigestSha1Hex();
}
@Override
public String getDigestSha1Hex() {
return this.certificateDigest;
}
}
......
......@@ -109,6 +109,11 @@ public class DirectorySignatureImpl implements DirectorySignature {
@Override
public String getSigningKeyDigest() {
return this.getSigningKeyDigestSha1Hex();
}
@Override
public String getSigningKeyDigestSha1Hex() {
return this.signingKeyDigest;
}
......
......@@ -889,6 +889,11 @@ public abstract class ExtraInfoDescriptorImpl extends DescriptorImpl
@Override
public String getExtraInfoDigest() {
return this.getDigestSha1Hex();
}
@Override
public String getDigestSha1Hex() {
return this.extraInfoDigest;
}
......@@ -896,6 +901,11 @@ public abstract class ExtraInfoDescriptorImpl extends DescriptorImpl
@Override
public String getExtraInfoDigestSha256() {
return this.getDigestSha256Base64();
}
@Override
public String getDigestSha256Base64() {
return this.extraInfoDigestSha256;
}
......@@ -938,6 +948,11 @@ public abstract class ExtraInfoDescriptorImpl extends DescriptorImpl
@Override
public String getGeoipDbDigest() {
return this.getGeoipDbDigestSha1Hex();
}
@Override
public String getGeoipDbDigestSha1Hex() {
return this.geoipDbDigest;
}
......@@ -945,6 +960,11 @@ public abstract class ExtraInfoDescriptorImpl extends DescriptorImpl
@Override
public String getGeoip6DbDigest() {
return this.getGeoip6DbDigestSha1Hex();
}
@Override
public String getGeoip6DbDigestSha1Hex() {
return this.geoip6DbDigest;
}
......
......@@ -264,6 +264,11 @@ public class MicrodescriptorImpl extends DescriptorImpl
@Override
public String getMicrodescriptorDigest() {
return this.getDigestSha256Base64();
}
@Override
public String getDigestSha256Base64() {
return this.microdescriptorDigest;
}
......
......@@ -337,6 +337,11 @@ public class NetworkStatusEntryImpl implements NetworkStatusEntry {
@Override
public Set<String> getMicrodescriptorDigests() {
return this.getMicrodescriptorDigestsSha256Base64();
}
@Override
public Set<String> getMicrodescriptorDigestsSha256Base64() {
return this.microdescriptorDigests == null ? null
: new HashSet<>(this.microdescriptorDigests);
}
......
......@@ -556,6 +556,11 @@ public class RelayDirectoryImpl extends DescriptorImpl
@Override
public String getDirectoryDigest() {
return this.getDigestSha1Hex();
}
@Override
public String getDigestSha1Hex() {
return this.directoryDigest;
}
}
......
......@@ -397,6 +397,11 @@ public class RelayNetworkStatusConsensusImpl extends NetworkStatusImpl
@Override
public String getConsensusDigest() {
return this.getDigestSha1Hex();
}
@Override
public String getDigestSha1Hex() {
return this.consensusDigest;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment