Update README.md with some of the plan
This commit is contained in:
@ -53,8 +53,8 @@ type CertificateInterface interface {
|
||||
}
|
||||
|
||||
type Certificate struct {
|
||||
CertType int
|
||||
CertLen int
|
||||
CertType int
|
||||
CertLen int
|
||||
CertBytes []byte
|
||||
}
|
||||
|
||||
|
@ -31,10 +31,8 @@ func Integer(number []byte) (value int) {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
|
||||
func IntegerBytes(value int) (number []byte) {
|
||||
number = make([]byte, INTEGER_SIZE)
|
||||
binary.BigEndian.PutUint64(number, uint64(value))
|
||||
return
|
||||
}
|
||||
}
|
||||
|
@ -75,12 +75,11 @@ const (
|
||||
)
|
||||
|
||||
type KeyCertificate struct {
|
||||
PKType int
|
||||
PKExtra []byte
|
||||
SPKType int
|
||||
PKType int
|
||||
PKExtra []byte
|
||||
SPKType int
|
||||
SPKExtra []byte
|
||||
}//[]byte
|
||||
|
||||
} //[]byte
|
||||
|
||||
//
|
||||
// The data contained in the Key Certificate.
|
||||
@ -177,7 +176,7 @@ func (key_certificate KeyCertificate) ConstructSigningPublicKey(data []byte) (si
|
||||
var ec_key crypto.ECP521PublicKey
|
||||
extra := KEYCERT_SIGN_P521_SIZE - KEYCERT_SPK_SIZE
|
||||
copy(ec_key[:], data)
|
||||
d , _ := key_certificate.Data()
|
||||
d, _ := key_certificate.Data()
|
||||
copy(ec_key[KEYCERT_SPK_SIZE:], d[4:4+extra])
|
||||
signing_public_key = ec_key
|
||||
case KEYCERT_SIGN_RSA2048:
|
||||
|
@ -64,6 +64,7 @@ type KeysAndCert struct {
|
||||
//crypto.PublicKey
|
||||
Certificate
|
||||
}
|
||||
|
||||
//[]byte
|
||||
|
||||
//
|
||||
@ -71,7 +72,7 @@ type KeysAndCert struct {
|
||||
// determine correct lengths.
|
||||
//
|
||||
func (keys_and_cert KeysAndCert) PublicKey() (key crypto.PublicKey, err error) {
|
||||
cert, err:= keys_and_cert.GetCertificate()
|
||||
cert, err := keys_and_cert.GetCertificate()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
@ -138,7 +139,7 @@ func (keys_and_cert KeysAndCert) SigningPublicKey() (signing_public_key crypto.S
|
||||
// This KeysAndCert contains a Key Certificate, construct
|
||||
// a SigningPublicKey from the data in the KeysAndCert and
|
||||
// any additional data in the Certificate.
|
||||
signing_public_key, err = KeyCertificate{SPKType:cert_type}.ConstructSigningPublicKey(
|
||||
signing_public_key, err = KeyCertificate{SPKType: cert_type}.ConstructSigningPublicKey(
|
||||
keys_and_cert.Cert()[KEYS_AND_CERT_PUBKEY_SIZE : KEYS_AND_CERT_PUBKEY_SIZE+KEYS_AND_CERT_SPK_SIZE],
|
||||
)
|
||||
} else {
|
||||
@ -191,7 +192,7 @@ func ReadKeysAndCert(data []byte) (keys_and_cert KeysAndCert, remainder []byte,
|
||||
return
|
||||
}
|
||||
|
||||
/* keys_and_cert = KeysAndCert{
|
||||
/* keys_and_cert = KeysAndCert{
|
||||
KeyCertificate: KeyCertificate{
|
||||
Certificate: data[:KEYS_AND_CERT_MIN_SIZE],
|
||||
PublicKey:,
|
||||
|
@ -31,17 +31,18 @@ end_date :: Date
|
||||
|
||||
// Sizes or various components of a Lease
|
||||
const (
|
||||
LEASE_SIZE = 44
|
||||
LEASE_HASH_SIZE = 32
|
||||
LEASE_TUNNEL_ID_SIZE = 4
|
||||
LEASE_SIZE = 44
|
||||
LEASE_HASH_SIZE = 32
|
||||
LEASE_TUNNEL_ID_SIZE = 4
|
||||
LEASE_TUNNEL_DATE_SIZE = 8
|
||||
)
|
||||
|
||||
type Lease struct {
|
||||
LeaseHash [LEASE_HASH_SIZE]byte
|
||||
LeaseHash [LEASE_HASH_SIZE]byte
|
||||
TunnelIdent [LEASE_TUNNEL_ID_SIZE]byte
|
||||
TunnelDate [LEASE_TUNNEL_DATE_SIZE]byte
|
||||
TunnelDate [LEASE_TUNNEL_DATE_SIZE]byte
|
||||
}
|
||||
|
||||
//[LEASE_SIZE]byte
|
||||
|
||||
//
|
||||
|
Reference in New Issue
Block a user