Don't redundantly(and falsely) count the remainder when reading KeysAndCert
This commit is contained in:
@ -35,12 +35,6 @@ func (destination Destination) Certificate() (Certificate, error) {
|
||||
return destination.KeysAndCert.GetCertificate()
|
||||
}
|
||||
|
||||
func ReadDestination(data []byte) (destination Destination, remainder []byte, err error) {
|
||||
keys_and_cert, remainder, err := ReadKeysAndCert(data)
|
||||
destination.KeysAndCert = keys_and_cert
|
||||
return
|
||||
}
|
||||
|
||||
//
|
||||
// Generate the I2P base32 address for this Destination.
|
||||
//
|
||||
@ -57,3 +51,12 @@ func (destination Destination) Base32Address() (str string) {
|
||||
func (destination Destination) Base64() string {
|
||||
return base64.EncodeToString(destination.Cert())
|
||||
}
|
||||
|
||||
func ReadDestination(data []byte) (destination Destination, remainder []byte, err error) {
|
||||
keys_and_cert, remainder, err := ReadKeysAndCert(data)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
destination.KeysAndCert = keys_and_cert
|
||||
return
|
||||
}
|
||||
|
@ -226,12 +226,6 @@ func ReadKeys(data []byte, cert Certificate) (spk crypto.SigningPublicKey, pk cr
|
||||
remainder = data[KEYS_AND_CERT_MIN_SIZE:]
|
||||
return
|
||||
}
|
||||
if data_len < KEYS_AND_CERT_MIN_SIZE+cert_len {
|
||||
cert.CertBytes = append(cert.Cert(), data[KEYS_AND_CERT_MIN_SIZE:]...)
|
||||
err = cert_len_err
|
||||
} else {
|
||||
cert.CertBytes = append(cert.Cert(), data[KEYS_AND_CERT_MIN_SIZE:KEYS_AND_CERT_MIN_SIZE+cert_len]...)
|
||||
remainder = data[KEYS_AND_CERT_MIN_SIZE+cert_len:]
|
||||
}
|
||||
remainder = data[KEYS_AND_CERT_PUBKEY_SIZE+KEYS_AND_CERT_SPK_SIZE:]
|
||||
return
|
||||
}
|
||||
|
@ -357,4 +357,11 @@ func (lease_set LeaseSet) OldestExpiration() (earliest Date, err error) {
|
||||
return
|
||||
}*/
|
||||
|
||||
//func ReadKeysAndCert(data []byte) (keys_and_cert KeysAndCert, remainder []byte, err error) {}
|
||||
func ReadLeaseSet(data []byte) (lease_set LeaseSet, remainder []byte, err error) {
|
||||
destination, remainder, err := ReadDestination(data)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
lease_set.Destination = destination
|
||||
return
|
||||
}
|
||||
|
Reference in New Issue
Block a user