pub fn sign(self, key: &P256KeyPair) -> Result<Gbl<E, Signed<'a>>, Error> {
        // Obtain the blob we want to sign
        let mut sign_data = Vec::with_capacity(1024); // save the first few likely resizes
        self.write_data_to_sign(&mut sign_data)
            .expect("writing into `Vec` failed");

        let sig = crypto::create_signature(key, &sign_data)?;

        // Now just attach the signature and we're done.
        Ok(Gbl {
            enc: self.enc,
            sig: Signed {
                signature: Signature {
                    raw: Blob(sig.to_vec().into()),
                },
            },
        })
    }
/// Creates and appends a digital signature for `self` using a private EC
/// key.
///
/// Returns the signed GBL.
///
/// Note that the signature created by this method is attached to the
/// *GBL container*, not the contained application image. In other words,
/// this signature can **not** be checked by the bootloader during secure
/// boot. If you want to use secure boot, you need to sign the *application
/// image* itself by using [`AppImage::sign`]. Also be aware that flashing
/// an application image with an invalid signature will prevent the device
/// from rebooting back into it, so you likely want to have *both* a signed
/// application image *and* a signed GBL container you can check *before*
/// flashing.
///
/// # Parameters
///
/// * `key`: The P-256 keypair to sign with.
///
/// [`AppImage::sign`]: struct.AppImage.html#method.sign
Creates and appends a digital signature for `self` using a private EC
key.

Returns the signed GBL.

Note that the signature created by this method is attached to the
GBL container*, not the contained application image. In other words,
this signature can **not** be checked by the bootloader during secure
boot. If you want to use secure boot, you need to sign the *application
image* itself by using [`AppImage::sign`].
Creates and appends a digital signature for ` self ` using a private EC key . Returns the signed GBL . Note that the signature created by this method is attached to the GBL container * not the contained application image . In other words this signature can ** not ** be checked by the bootloader during secure boot . If you want to use secure boot you need to sign the * application image * itself by using [ ` AppImage :: sign ` ] .
pub fn sign(self, key: &P256KeyPair) -> Result<Gbl<E, Signed<'a>>, Error> {
        // Obtain the blob we want to sign
        let mut sign_data = Vec::with_capacity(1024); // save the first few likely resizes
        self.write_data_to_sign(&mut sign_data)
            .expect("writing into `Vec` failed");
        let sig = crypto::create_signature(key, &sign_data)?;
        // Now just attach the signature and we're done.
        Ok(Gbl {
            enc: self.enc,
            sig: Signed {
                signature: Signature {
                    raw: Blob(sig.to_vec().into()),
                },
            },
        })
    }
pub fn sign ( self , key : & P256KeyPair ) -> Result < Gbl < E , Signed < ' a > > , Error > { // Obtain the blob we want to sign let mut sign_data = Vec :: with_capacity ( 1024 ) ; // save the first few likely resizes self . write_data_to_sign ( & mut sign_data ) . expect ( " " ) ; let sig = crypto :: create_signature ( key , & sign_data ) ? ; // Now just attach the signature and we're done. Ok ( Gbl { enc : self . enc , sig : Signed { signature : Signature { raw : Blob ( sig . to_vec ( ) . into ( ) ) , } , } , } ) }
Creates and appends a digital signature for `self` using a private EC
key.
Creates and appends a digital signature for ` self ` using a private EC key .
self
key
&P256KeyPair