pub fn new(metadata: &M, private_key: &PrivateKey) -> Result<Self> {
        let raw = D::serialize(metadata)?;
        let bytes = D::canonicalize(&raw)?;
        let sig = private_key.sign(&bytes)?;
        Ok(Self {
            signatures: vec![sig],
            metadata: raw,
            _marker: PhantomData,
        })
    }
/// Create a new `SignedMetadata`. The supplied private key is used to sign the canonicalized
/// bytes of the provided metadata with the provided scheme.
///
/// ```
/// # use chrono::prelude::*;
/// # use in_toto::crypto::{PrivateKey, SignatureScheme, HashAlgorithm};
/// # use in_toto::interchange::Json;
/// # use in_toto::metadata::{SignedMetadata};
/// #
/// # fn main() {
/// # let key: &[u8] = include_bytes!("../tests/ed25519/ed25519-1.pk8.der");
/// let key = PrivateKey::from_pkcs8(&key, SignatureScheme::Ed25519).unwrap();
///
/// # }
/// ```
Create a new `SignedMetadata`. The supplied private key is used to sign the canonicalized
bytes of the provided metadata with the provided scheme.


Create a new ` SignedMetadata ` . The supplied private key is used to sign the canonicalized bytes of the provided metadata with the provided scheme .
pub fn new(metadata: &M, private_key: &PrivateKey) -> Result<Self> {
        let raw = D::serialize(metadata)?;
        let bytes = D::canonicalize(&raw)?;
        let sig = private_key.sign(&bytes)?;
        Ok(Self {
            signatures: vec![sig],
            metadata: raw,
            _marker: PhantomData,
        })
    }
pub fn new ( metadata : & M , private_key : & PrivateKey ) -> Result < Self > { let raw = D :: serialize ( metadata ) ? ; let bytes = D :: canonicalize ( & raw ) ? ; let sig = private_key . sign ( & bytes ) ? ; Ok ( Self { signatures : vec ! [ sig ] , metadata : raw , _marker : PhantomData , } ) }
Create a new `SignedMetadata`.
Create a new ` SignedMetadata ` .
metadata
&M
private_key
&PrivateKey
metadata
&M
private_key
&PrivateKey
use chrono::prelude::*;
None
use in_toto::crypto::{privatekey, signaturescheme, hashalgorithm};
None
use in_toto::interchange::json;
None
use in_toto::metadata::{signedmetadata};
None
fn main() {
None
let key: &[u8] = include_bytes!("../tests/ed25519/ed25519-1.pk8.der");
let key = PrivateKey::from_pkcs8(&key, SignatureScheme::Ed25519).unwrap().
let key = PrivateKey :: from_pkcs8 ( &key SignatureScheme :: Ed25519 ) . unwrap () .
}
None