【Rust】RustでSECP256k1

$ cargo add hex-literal k256

[dependencies]
chrono = "0.4.23"
hex-literal = "0.4.1"
k256 = "0.13.4"
use hex_literal::hex;
use k256::{ecdsa::{SigningKey, Signature, signature::Signer, signature::Verifier, VerifyingKey}};

fn main(){
    let private_key: SigningKey = SigningKey::from_bytes(&hex!(
        "DCDFF4B7CA287CC7BD30ECAEF0622265DB4E14054E12954225457C3A6B84F135"
    ).into()).unwrap();

    let public_key: &VerifyingKey = private_key.verifying_key();

    let message = b"hello, world";
    let signature: Signature = private_key.sign(message);

    let verified = public_key.verify(message, &signature).is_ok();

    println!("private key: {:X?}", private_key.to_bytes());
    println!("public key: {:X?}", public_key.to_encoded_point(false).to_bytes());
    println!("message: {:X?}", message);
    println!("Signature: {:X?}", signature.to_bytes());
    println!("verified: {:X?}", verified);

}

private key: [DC, DF, F4, B7, CA, 28, 7C, C7, BD, 30, EC, AE, F0, 62, 22, 65, DB, 4E, 14, 5, 4E, 12, 95, 42, 25, 45, 7C, 3A, 6B, 84, F1, 35]
public key: [4, BA, C6, CB, 0, F, 4, AD, 63, 97, 7, 52, C3, D7, 3B, 88, C5, C8, 6E, 3D, 88, AC, 69, 51, 18, 49, 4A, 1, 73, 2E, 2A, BD, 16, C7, 6A, CA, D3, D6, 58, 6C, 37, C8, DB, 7E, 69, C2, F8, 12, F9, 92, 75, 19, 89, 36, 95, 7D, 72, C3, 8D, 71, 9, 81, 99, 11, 23]
message: [68, 65, 6C, 6C, 6F, 2C, 20, 77, 6F, 72, 6C, 64]
Signature: [F6, 90, AF, FF, D2, 46, 23, 62, 7B, FA, 97, 99, 68, 73, A6, A9, D8, CA, 8E, 9B, B7, AB, 6A, D2, 69, C9, 29, 45, 3B, 42, 98, 55, 73, CD, C4, C0, 5B, 85, 22, 22, 40, 65, 75, 7F, EF, 6C, 18, 1, C8, 41, 8F, FD, 3D, EB, DA, B, 4B, E2, 2A, 73, B2, E5, B6, CE]
verified: true