mirror of
https://github.com/slackhq/nebula.git
synced 2025-12-30 18:48:28 +01:00
resolve setSignature TODO
This commit is contained in:
@@ -329,6 +329,9 @@ func (c *certificateV1) marshalForSigning() ([]byte, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *certificateV1) setSignature(b []byte) error {
|
func (c *certificateV1) setSignature(b []byte) error {
|
||||||
|
if len(b) == 0 {
|
||||||
|
return ErrEmptySignature
|
||||||
|
}
|
||||||
c.signature = b
|
c.signature = b
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -390,6 +390,9 @@ func (c *certificateV2) marshalForSigning() ([]byte, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *certificateV2) setSignature(b []byte) error {
|
func (c *certificateV2) setSignature(b []byte) error {
|
||||||
|
if len(b) == 0 {
|
||||||
|
return ErrEmptySignature
|
||||||
|
}
|
||||||
c.signature = b
|
c.signature = b
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,4 +31,5 @@ var (
|
|||||||
ErrNoPayload = errors.New("provided payload was empty")
|
ErrNoPayload = errors.New("provided payload was empty")
|
||||||
|
|
||||||
ErrMissingDetails = errors.New("certificate did not contain details")
|
ErrMissingDetails = errors.New("certificate did not contain details")
|
||||||
|
ErrEmptySignature = errors.New("empty signature")
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ type beingSignedCertificate interface {
|
|||||||
// marshalForSigning returns the bytes that should be signed
|
// marshalForSigning returns the bytes that should be signed
|
||||||
marshalForSigning() ([]byte, error)
|
marshalForSigning() ([]byte, error)
|
||||||
|
|
||||||
// setSignature sets the signature for the certificate that has just been signed
|
// setSignature sets the signature for the certificate that has just been signed. The signature must not be blank.
|
||||||
setSignature([]byte) error
|
setSignature([]byte) error
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,7 +138,6 @@ func (t *TBSCertificate) SignWith(signer Certificate, curve Curve, sp SignerLamb
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: check if we have sig bytes?
|
|
||||||
err = c.setSignature(sig)
|
err = c.setSignature(sig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|||||||
Reference in New Issue
Block a user