From f64345c75364ac55eb02ce17318ba95393fb91aa Mon Sep 17 00:00:00 2001 From: Vivek Arte Date: Mon, 7 Jul 2025 17:32:12 +0530 Subject: [PATCH 1/9] making the change to the encoding of ik --- src/keys.rs | 58 ++++++++++++++++++++++++++++++++---------- src/note/asset_base.rs | 14 +++++----- 2 files changed, 53 insertions(+), 19 deletions(-) diff --git a/src/keys.rs b/src/keys.rs index 44482602d..e9a777b9d 100644 --- a/src/keys.rs +++ b/src/keys.rs @@ -16,7 +16,7 @@ use k256::{ schnorr, schnorr::{ signature::hazmat::{PrehashSigner, PrehashVerifier}, - Signature, VerifyingKey, + Signature, }, NonZeroScalar, }; @@ -40,6 +40,7 @@ use crate::{ // Preserve '::' which specifies the EXTERNAL 'zip32' crate #[rustfmt::skip] pub use ::zip32::{AccountId, ChildIndex, DiversifierIndex, Scope, hardened_only}; +use crate::keys::IssuanceAuthSigScheme::ZIP227; const KDF_ORCHARD_PERSONALIZATION: &[u8; 16] = b"Zcash_OrchardKDF"; const ZIP32_PURPOSE: u32 = 32; @@ -239,6 +240,15 @@ fn check_structural_validity( } } +/// An enum of the supported scheme used for issuance authorization signatures. +#[derive(Debug, Clone)] +pub enum IssuanceAuthSigScheme { + /// The signature scheme specified in [ZIP 227][issuanceauthsig]. + /// + /// [issuanceauthsig]: https://zips.z.cash/zip-0227#orchard-zsa-issuance-authorization-signature-scheme + ZIP227, +} + /// An issuance key, from which all key material is derived. /// /// $\mathsf{isk}$ as defined in [ZIP 227][issuancekeycomponents]. @@ -314,11 +324,17 @@ impl Debug for IssuanceAuthorizingKey { /// /// [IssuanceZSA]: https://zips.z.cash/zip-0227#issuance-key-derivation #[derive(Debug, Clone)] -pub struct IssuanceValidatingKey(schnorr::VerifyingKey); +pub struct IssuanceValidatingKey { + scheme: IssuanceAuthSigScheme, + key: schnorr::VerifyingKey, +} impl From<&IssuanceAuthorizingKey> for IssuanceValidatingKey { fn from(isk: &IssuanceAuthorizingKey) -> Self { - IssuanceValidatingKey(*schnorr::SigningKey::from(isk.0).verifying_key()) + IssuanceValidatingKey { + scheme: ZIP227, + key: *schnorr::SigningKey::from(isk.0).verifying_key(), + } } } @@ -331,10 +347,15 @@ impl PartialEq for IssuanceValidatingKey { impl Eq for IssuanceValidatingKey {} impl IssuanceValidatingKey { - /// Converts this issuance validating key to its serialized form, - /// in big-endian order as defined in BIP 340. - pub fn to_bytes(&self) -> [u8; 32] { - self.0.to_bytes().into() + /// Converts this issuance validating key to its serialized form, with a scheme byte prefix, + /// and the key in big-endian order as defined in BIP 340. + pub fn to_bytes(&self) -> [u8; 33] { + let mut bytes = [0u8; 33]; + match self.scheme { + ZIP227 => bytes[0] = 0x00, + } + bytes[1..].copy_from_slice(&self.key.to_bytes()); + bytes } /// Constructs an Orchard issuance validating key from the provided bytes. @@ -342,14 +363,21 @@ impl IssuanceValidatingKey { /// /// Returns `None` if the bytes do not correspond to a valid key. pub fn from_bytes(bytes: &[u8]) -> Option { - VerifyingKey::from_bytes(bytes) - .ok() - .map(IssuanceValidatingKey) + if bytes.first() == Some(&0x00) { + schnorr::VerifyingKey::from_bytes(&bytes[1..]) + .ok() + .map(|key| IssuanceValidatingKey { + scheme: ZIP227, + key, + }) + } else { + None + } } /// Verifies a purported `signature` over `msg` made by this verification key. pub fn verify(&self, msg: &[u8], signature: &Signature) -> Result<(), schnorr::Error> { - self.0.verify_prehash(msg, signature) + self.key.verify_prehash(msg, signature) } } @@ -1213,7 +1241,9 @@ mod tests { assert_eq!(<[u8; 32]>::from(ak.0), tv.ak); let ik: IssuanceValidatingKey = (&isk).into(); - assert_eq!(ik.to_bytes(), tv.ik); + let mut key_bytes = [0u8; 33]; + key_bytes[1..].copy_from_slice(&tv.ik); + assert_eq!(ik.to_bytes(), key_bytes); //TODO: VA: Fix this test vector let nk: NullifierDerivingKey = (&sk).into(); assert_eq!(nk.0.to_repr(), tv.nk); @@ -1267,7 +1297,9 @@ mod tests { let isk = IssuanceAuthorizingKey::from_bytes(tv.isk).unwrap(); let ik = IssuanceValidatingKey::from(&isk); - assert_eq!(ik.to_bytes(), tv.ik); + let mut key_bytes = [0u8; 33]; + key_bytes[1..].copy_from_slice(&tv.ik); + assert_eq!(ik.to_bytes(), key_bytes); //TODO: VA: Fix this test vector let message = tv.msg; diff --git a/src/note/asset_base.rs b/src/note/asset_base.rs index fd8d09af8..9e8f5e3d1 100644 --- a/src/note/asset_base.rs +++ b/src/note/asset_base.rs @@ -46,7 +46,7 @@ pub const ZSA_ASSET_DIGEST_PERSONALIZATION: &[u8; 16] = b"ZSA-Asset-Digest"; /// Defined in [ZIP-227: Issuance of Zcash Shielded Assets][assetdigest]. /// /// [assetdigest]: https://zips.z.cash/zip-0227.html#specification-asset-identifier-asset-digest-and-asset-base -pub fn asset_digest(encode_asset_id: [u8; 65]) -> Blake2bHash { +pub fn asset_digest(encode_asset_id: [u8; 66]) -> Blake2bHash { Params::new() .hash_length(64) .personal(ZSA_ASSET_DIGEST_PERSONALIZATION) @@ -80,11 +80,11 @@ impl AssetBase { let version_byte = [0x00]; // EncodeAssetId(ik, asset_desc_hash) = version_byte || ik || asset_desc_hash - let encode_asset_id: [u8; 65] = { - let mut array = [0u8; 65]; + let encode_asset_id: [u8; 66] = { + let mut array = [0u8; 66]; array[..1].copy_from_slice(&version_byte); - array[1..33].copy_from_slice(&ik.to_bytes()); - array[33..].copy_from_slice(asset_desc_hash); + array[1..34].copy_from_slice(&ik.to_bytes()); + array[34..].copy_from_slice(asset_desc_hash); array }; @@ -206,8 +206,10 @@ pub mod testing { let asset_desc_hash = crate::issuance::compute_asset_desc_hash( &nonempty::NonEmpty::from_slice(&tv.description).unwrap(), ); + let mut key_bytes = [0u8; 33]; + key_bytes[1..].copy_from_slice(&tv.key); let calculated_asset_base = AssetBase::derive( - &IssuanceValidatingKey::from_bytes(&tv.key).unwrap(), + &IssuanceValidatingKey::from_bytes(&key_bytes).unwrap(), // TODO: VA: fix test vector &asset_desc_hash, ); let test_vector_asset_base = AssetBase::from_bytes(&tv.asset_base).unwrap(); From 41d63b356374ed0ba3ce955b4bd1680107222132 Mon Sep 17 00:00:00 2001 From: Vivek Arte Date: Tue, 8 Jul 2025 19:30:24 +0530 Subject: [PATCH 2/9] updating the issueAuthSig encoding to include the algorithm selection bit --- src/bundle/commitments.rs | 2 +- src/issuance.rs | 76 ++++++++++++++++++++++++++++++++++----- src/keys.rs | 38 ++++++++++++++------ 3 files changed, 96 insertions(+), 20 deletions(-) diff --git a/src/bundle/commitments.rs b/src/bundle/commitments.rs index 014fc07c1..3e688048e 100644 --- a/src/bundle/commitments.rs +++ b/src/bundle/commitments.rs @@ -123,7 +123,7 @@ pub(crate) fn hash_issue_bundle_txid_data(bundle: &IssueBundle) /// [zip246]: https://zips.z.cash/zip-0246 pub(crate) fn hash_issue_bundle_auth_data(bundle: &IssueBundle) -> Blake2bHash { let mut h = hasher(ZCASH_ORCHARD_ZSA_ISSUE_SIG_PERSONALIZATION); - h.update(&<[u8; 64]>::from(bundle.authorization().signature())); + h.update(&bundle.authorization().signature().to_bytes()); h.finalize() } diff --git a/src/issuance.rs b/src/issuance.rs index e32c94086..1cd3a5b93 100644 --- a/src/issuance.rs +++ b/src/issuance.rs @@ -33,7 +33,7 @@ use crate::{ use Error::{ AssetBaseCannotBeIdentityPoint, CannotBeFirstIssuance, IssueActionNotFound, IssueActionPreviouslyFinalizedAssetBase, IssueActionWithoutNoteNotFinalized, - IssueBundleIkMismatchAssetBase, IssueBundleInvalidSignature, + IssueAuthSigGenerationFailed, IssueBundleIkMismatchAssetBase, IssueBundleInvalidSignature, MissingReferenceNoteOnFirstIssuance, ValueOverflow, }; @@ -79,6 +79,53 @@ pub struct IssueInfo { pub value: NoteValue, } +/// The type of an Issuance Authorization Signature +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct IssuanceAuthorizationSignature { + scheme: IssuanceAuthSigScheme, + signature: schnorr::Signature, +} + +impl IssuanceAuthorizationSignature { + /// Constructs a new `IssuanceAuthorizationSignature`. + pub fn new(scheme: IssuanceAuthSigScheme, signature: schnorr::Signature) -> Self { + IssuanceAuthorizationSignature { scheme, signature } + } + + /// Returns the scheme of the signature. + pub fn scheme(&self) -> &IssuanceAuthSigScheme { + &self.scheme + } + + /// Returns the signature. + pub fn signature(&self) -> &schnorr::Signature { + &self.signature + } + + /// Returns the byte encoding of the signature. + pub fn to_bytes(&self) -> [u8; 65] { + let mut bytes = [0u8; 65]; + match &self.scheme { + IssuanceAuthSigScheme::ZIP227 => bytes[0] = 0x00, + } + bytes[1..].copy_from_slice(&self.signature.to_bytes()); + bytes + } + + /// Constructs an `IssuanceAuthorizationSignature` from a byte array. + pub fn from_bytes(bytes: &[u8; 65]) -> Result { + if bytes.first() != Some(&0x00) { + return Err(IssueBundleInvalidSignature); + } + let signature = + schnorr::Signature::try_from(&bytes[1..]).map_err(|_| IssueBundleInvalidSignature)?; + Ok(IssuanceAuthorizationSignature { + scheme: IssuanceAuthSigScheme::ZIP227, + signature, + }) + } +} + /// Compute the asset description hash for a given asset description. /// /// # Panics @@ -240,19 +287,19 @@ pub struct Prepared { /// Marker for an authorized bundle. #[derive(Debug, Clone, PartialEq, Eq)] pub struct Signed { - signature: schnorr::Signature, + signature: IssuanceAuthorizationSignature, } impl Signed { /// Returns the signature for this authorization. - pub fn signature(&self) -> &schnorr::Signature { + pub fn signature(&self) -> &IssuanceAuthorizationSignature { &self.signature } /// Constructs a `Signed` from a byte array containing Schnorr signature bytes. - pub fn from_data(data: [u8; 64]) -> Self { + pub fn from_data(data: [u8; 65]) -> Self { Signed { - signature: schnorr::Signature::try_from(data.as_ref()).unwrap(), + signature: IssuanceAuthorizationSignature::from_bytes(&data).unwrap(), } } } @@ -687,6 +734,9 @@ pub enum Error { /// It cannot be first issuance because we have already some notes for this asset. CannotBeFirstIssuance, + /// The generation of the Issuance Authorization Signature failed. + IssueAuthSigGenerationFailed, //TODO: VA: This does not propagate the schnorr::Error, fix it. + /// Verification errors: /// Invalid signature. IssueBundleInvalidSignature, @@ -730,6 +780,9 @@ impl fmt::Display for Error { "it cannot be first issuance because we have already some notes for this asset." ) } + IssueAuthSigGenerationFailed => { + write!(f, "failed to generate the Issuance Authorization Signature") + } IssueBundleInvalidSignature => { write!(f, "invalid signature") } @@ -1848,8 +1901,12 @@ mod tests { #[cfg_attr(docsrs, doc(cfg(feature = "test-dependencies")))] pub mod testing { use crate::{ - issuance::{AwaitingNullifier, IssueAction, IssueBundle, Prepared, Signed}, + issuance::{ + AwaitingNullifier, IssuanceAuthorizationSignature, IssueAction, IssueBundle, Prepared, + Signed, + }, keys::testing::arb_issuance_validating_key, + keys::IssuanceAuthSigScheme::ZIP227, note::asset_base::testing::zsa_asset_base, note::testing::arb_zsa_note, }; @@ -1863,8 +1920,11 @@ pub mod testing { /// Generate a uniformly distributed signature pub(crate) fn arb_signature()( sig_bytes in vec(prop::num::u8::ANY, 64) - ) -> schnorr::Signature { - schnorr::Signature::try_from(sig_bytes.as_slice()).unwrap() + ) -> IssuanceAuthorizationSignature { + IssuanceAuthorizationSignature::new( + ZIP227, + schnorr::Signature::try_from(sig_bytes.as_slice()).unwrap() + ) } } diff --git a/src/keys.rs b/src/keys.rs index e9a777b9d..d4d102b5d 100644 --- a/src/keys.rs +++ b/src/keys.rs @@ -14,10 +14,7 @@ use group::{ }; use k256::{ schnorr, - schnorr::{ - signature::hazmat::{PrehashSigner, PrehashVerifier}, - Signature, - }, + schnorr::signature::hazmat::{PrehashSigner, PrehashVerifier}, NonZeroScalar, }; use pasta_curves::{pallas, pallas::Scalar}; @@ -28,6 +25,7 @@ use zcash_note_encryption::EphemeralKeyBytes; use crate::{ address::Address, + issuance, primitives::redpallas::{self, SpendAuth, VerificationKey}, spec::{ commit_ivk, diversify_hash, extract_p, ka_orchard, ka_orchard_prepared, prf_nf, to_base, @@ -40,6 +38,7 @@ use crate::{ // Preserve '::' which specifies the EXTERNAL 'zip32' crate #[rustfmt::skip] pub use ::zip32::{AccountId, ChildIndex, DiversifierIndex, Scope, hardened_only}; +use crate::issuance::IssuanceAuthorizationSignature; use crate::keys::IssuanceAuthSigScheme::ZIP227; const KDF_ORCHARD_PERSONALIZATION: &[u8; 16] = b"Zcash_OrchardKDF"; @@ -241,7 +240,7 @@ fn check_structural_validity( } /// An enum of the supported scheme used for issuance authorization signatures. -#[derive(Debug, Clone)] +#[derive(Debug, Clone, PartialEq, Eq)] pub enum IssuanceAuthSigScheme { /// The signature scheme specified in [ZIP 227][issuanceauthsig]. /// @@ -305,8 +304,17 @@ impl IssuanceAuthorizingKey { /// Sign the provided message using the `IssuanceAuthorizingKey`. /// Only supports signing of messages of length 32 bytes, since we will only be using it to sign 32 byte SIGHASH values. - pub fn try_sign(&self, msg: &[u8; 32]) -> Result { - schnorr::SigningKey::from(self.0).sign_prehash(msg) + pub fn try_sign( + &self, + msg: &[u8; 32], + ) -> Result { + let signature = schnorr::SigningKey::from(self.0) + .sign_prehash(msg) + .map_err(|_| issuance::Error::IssueAuthSigGenerationFailed)?; + Ok(IssuanceAuthorizationSignature::new( + IssuanceAuthSigScheme::ZIP227, + signature, + )) } } @@ -376,8 +384,14 @@ impl IssuanceValidatingKey { } /// Verifies a purported `signature` over `msg` made by this verification key. - pub fn verify(&self, msg: &[u8], signature: &Signature) -> Result<(), schnorr::Error> { - self.key.verify_prehash(msg, signature) + pub fn verify( + &self, + msg: &[u8], + sig: &IssuanceAuthorizationSignature, + ) -> Result<(), issuance::Error> { + self.key + .verify_prehash(msg, sig.signature()) + .map_err(|_| issuance::Error::IssueBundleInvalidSignature) } } @@ -1304,8 +1318,10 @@ mod tests { let message = tv.msg; let signature = isk.try_sign(&message).unwrap(); - let sig_bytes: [u8; 64] = signature.to_bytes(); - assert_eq!(sig_bytes, tv.sig); + let mut tv_sig_bytes = [0u8; 65]; + tv_sig_bytes[1..].copy_from_slice(&tv.sig); + let sig_bytes: [u8; 65] = signature.to_bytes(); + assert_eq!(sig_bytes, tv_sig_bytes); assert!(ik.verify(&message, &signature).is_ok()); } From b6e762349fac5028c7a11d2c856b59b453544355 Mon Sep 17 00:00:00 2001 From: Vivek Arte Date: Wed, 9 Jul 2025 12:19:12 +0530 Subject: [PATCH 3/9] improving imports --- src/keys.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/keys.rs b/src/keys.rs index d4d102b5d..cbcf4782c 100644 --- a/src/keys.rs +++ b/src/keys.rs @@ -26,6 +26,7 @@ use zcash_note_encryption::EphemeralKeyBytes; use crate::{ address::Address, issuance, + issuance::IssuanceAuthorizationSignature, primitives::redpallas::{self, SpendAuth, VerificationKey}, spec::{ commit_ivk, diversify_hash, extract_p, ka_orchard, ka_orchard_prepared, prf_nf, to_base, @@ -38,8 +39,6 @@ use crate::{ // Preserve '::' which specifies the EXTERNAL 'zip32' crate #[rustfmt::skip] pub use ::zip32::{AccountId, ChildIndex, DiversifierIndex, Scope, hardened_only}; -use crate::issuance::IssuanceAuthorizationSignature; -use crate::keys::IssuanceAuthSigScheme::ZIP227; const KDF_ORCHARD_PERSONALIZATION: &[u8; 16] = b"Zcash_OrchardKDF"; const ZIP32_PURPOSE: u32 = 32; @@ -340,7 +339,7 @@ pub struct IssuanceValidatingKey { impl From<&IssuanceAuthorizingKey> for IssuanceValidatingKey { fn from(isk: &IssuanceAuthorizingKey) -> Self { IssuanceValidatingKey { - scheme: ZIP227, + scheme: IssuanceAuthSigScheme::ZIP227, key: *schnorr::SigningKey::from(isk.0).verifying_key(), } } @@ -360,7 +359,7 @@ impl IssuanceValidatingKey { pub fn to_bytes(&self) -> [u8; 33] { let mut bytes = [0u8; 33]; match self.scheme { - ZIP227 => bytes[0] = 0x00, + IssuanceAuthSigScheme::ZIP227 => bytes[0] = 0x00, } bytes[1..].copy_from_slice(&self.key.to_bytes()); bytes @@ -375,7 +374,7 @@ impl IssuanceValidatingKey { schnorr::VerifyingKey::from_bytes(&bytes[1..]) .ok() .map(|key| IssuanceValidatingKey { - scheme: ZIP227, + scheme: IssuanceAuthSigScheme::ZIP227, key, }) } else { From 3b1781ebb82b402c3119204bc6ac71b1e368b0e0 Mon Sep 17 00:00:00 2001 From: Vivek Arte Date: Sat, 12 Jul 2025 22:13:25 +0530 Subject: [PATCH 4/9] updating test vectors and reverting stopgap changes --- src/issuance.rs | 8 +- src/keys.rs | 22 +-- src/note/asset_base.rs | 4 +- src/test_vectors/asset_base.rs | 242 +++++++++++++------------- src/test_vectors/issuance_auth_sig.rs | 180 +++++++++---------- src/test_vectors/keys.rs | 62 +++---- 6 files changed, 255 insertions(+), 263 deletions(-) diff --git a/src/issuance.rs b/src/issuance.rs index 1cd3a5b93..de6aab31f 100644 --- a/src/issuance.rs +++ b/src/issuance.rs @@ -106,7 +106,7 @@ impl IssuanceAuthorizationSignature { pub fn to_bytes(&self) -> [u8; 65] { let mut bytes = [0u8; 65]; match &self.scheme { - IssuanceAuthSigScheme::ZIP227 => bytes[0] = 0x00, + IssuanceAuthSigScheme::Zip227 => bytes[0] = 0x00, } bytes[1..].copy_from_slice(&self.signature.to_bytes()); bytes @@ -120,7 +120,7 @@ impl IssuanceAuthorizationSignature { let signature = schnorr::Signature::try_from(&bytes[1..]).map_err(|_| IssueBundleInvalidSignature)?; Ok(IssuanceAuthorizationSignature { - scheme: IssuanceAuthSigScheme::ZIP227, + scheme: IssuanceAuthSigScheme::Zip227, signature, }) } @@ -1906,7 +1906,7 @@ pub mod testing { Signed, }, keys::testing::arb_issuance_validating_key, - keys::IssuanceAuthSigScheme::ZIP227, + keys::IssuanceAuthSigScheme::Zip227, note::asset_base::testing::zsa_asset_base, note::testing::arb_zsa_note, }; @@ -1922,7 +1922,7 @@ pub mod testing { sig_bytes in vec(prop::num::u8::ANY, 64) ) -> IssuanceAuthorizationSignature { IssuanceAuthorizationSignature::new( - ZIP227, + Zip227, schnorr::Signature::try_from(sig_bytes.as_slice()).unwrap() ) } diff --git a/src/keys.rs b/src/keys.rs index cbcf4782c..c79af07b3 100644 --- a/src/keys.rs +++ b/src/keys.rs @@ -244,7 +244,7 @@ pub enum IssuanceAuthSigScheme { /// The signature scheme specified in [ZIP 227][issuanceauthsig]. /// /// [issuanceauthsig]: https://zips.z.cash/zip-0227#orchard-zsa-issuance-authorization-signature-scheme - ZIP227, + Zip227, } /// An issuance key, from which all key material is derived. @@ -311,7 +311,7 @@ impl IssuanceAuthorizingKey { .sign_prehash(msg) .map_err(|_| issuance::Error::IssueAuthSigGenerationFailed)?; Ok(IssuanceAuthorizationSignature::new( - IssuanceAuthSigScheme::ZIP227, + IssuanceAuthSigScheme::Zip227, signature, )) } @@ -339,7 +339,7 @@ pub struct IssuanceValidatingKey { impl From<&IssuanceAuthorizingKey> for IssuanceValidatingKey { fn from(isk: &IssuanceAuthorizingKey) -> Self { IssuanceValidatingKey { - scheme: IssuanceAuthSigScheme::ZIP227, + scheme: IssuanceAuthSigScheme::Zip227, key: *schnorr::SigningKey::from(isk.0).verifying_key(), } } @@ -359,7 +359,7 @@ impl IssuanceValidatingKey { pub fn to_bytes(&self) -> [u8; 33] { let mut bytes = [0u8; 33]; match self.scheme { - IssuanceAuthSigScheme::ZIP227 => bytes[0] = 0x00, + IssuanceAuthSigScheme::Zip227 => bytes[0] = 0x00, } bytes[1..].copy_from_slice(&self.key.to_bytes()); bytes @@ -374,7 +374,7 @@ impl IssuanceValidatingKey { schnorr::VerifyingKey::from_bytes(&bytes[1..]) .ok() .map(|key| IssuanceValidatingKey { - scheme: IssuanceAuthSigScheme::ZIP227, + scheme: IssuanceAuthSigScheme::Zip227, key, }) } else { @@ -1254,9 +1254,7 @@ mod tests { assert_eq!(<[u8; 32]>::from(ak.0), tv.ak); let ik: IssuanceValidatingKey = (&isk).into(); - let mut key_bytes = [0u8; 33]; - key_bytes[1..].copy_from_slice(&tv.ik); - assert_eq!(ik.to_bytes(), key_bytes); //TODO: VA: Fix this test vector + assert_eq!(ik.to_bytes(), tv.ik); let nk: NullifierDerivingKey = (&sk).into(); assert_eq!(nk.0.to_repr(), tv.nk); @@ -1310,17 +1308,13 @@ mod tests { let isk = IssuanceAuthorizingKey::from_bytes(tv.isk).unwrap(); let ik = IssuanceValidatingKey::from(&isk); - let mut key_bytes = [0u8; 33]; - key_bytes[1..].copy_from_slice(&tv.ik); - assert_eq!(ik.to_bytes(), key_bytes); //TODO: VA: Fix this test vector + assert_eq!(ik.to_bytes(), tv.ik); let message = tv.msg; let signature = isk.try_sign(&message).unwrap(); - let mut tv_sig_bytes = [0u8; 65]; - tv_sig_bytes[1..].copy_from_slice(&tv.sig); let sig_bytes: [u8; 65] = signature.to_bytes(); - assert_eq!(sig_bytes, tv_sig_bytes); + assert_eq!(sig_bytes, tv.sig); assert!(ik.verify(&message, &signature).is_ok()); } diff --git a/src/note/asset_base.rs b/src/note/asset_base.rs index 9e8f5e3d1..9e7540e27 100644 --- a/src/note/asset_base.rs +++ b/src/note/asset_base.rs @@ -206,10 +206,8 @@ pub mod testing { let asset_desc_hash = crate::issuance::compute_asset_desc_hash( &nonempty::NonEmpty::from_slice(&tv.description).unwrap(), ); - let mut key_bytes = [0u8; 33]; - key_bytes[1..].copy_from_slice(&tv.key); let calculated_asset_base = AssetBase::derive( - &IssuanceValidatingKey::from_bytes(&key_bytes).unwrap(), // TODO: VA: fix test vector + &IssuanceValidatingKey::from_bytes(&tv.key).unwrap(), &asset_desc_hash, ); let test_vector_asset_base = AssetBase::from_bytes(&tv.asset_base).unwrap(); diff --git a/src/test_vectors/asset_base.rs b/src/test_vectors/asset_base.rs index 2aed92c25..6366c59c4 100644 --- a/src/test_vectors/asset_base.rs +++ b/src/test_vectors/asset_base.rs @@ -1,7 +1,7 @@ // From https://github.com/zcash-hackworks/zcash-test-vectors/blob/master/orchard_zsa_asset_base.py pub(crate) struct TestVector { - pub(crate) key: [u8; 32], + pub(crate) key: [u8; 33], pub(crate) description: [u8; 512], pub(crate) asset_base: [u8; 32], } @@ -9,9 +9,9 @@ pub(crate) struct TestVector { pub(crate) const TEST_VECTORS: &[TestVector] = &[ TestVector { key: [ - 0x4b, 0xec, 0xe1, 0xff, 0x00, 0xe2, 0xed, 0x77, 0x64, 0xae, 0x6b, 0xe2, 0x0d, 0x2f, - 0x67, 0x22, 0x04, 0xfc, 0x86, 0xcc, 0xed, 0xd6, 0xfc, 0x1f, 0x71, 0xdf, 0x02, 0xc7, - 0x51, 0x6d, 0x9f, 0x31, + 0x00, 0x4b, 0xec, 0xe1, 0xff, 0x00, 0xe2, 0xed, 0x77, 0x64, 0xae, 0x6b, 0xe2, 0x0d, + 0x2f, 0x67, 0x22, 0x04, 0xfc, 0x86, 0xcc, 0xed, 0xd6, 0xfc, 0x1f, 0x71, 0xdf, 0x02, + 0xc7, 0x51, 0x6d, 0x9f, 0x31, ], description: [ 0xc2, 0xb9, 0xc3, 0x8b, 0xe1, 0x9a, 0xa4, 0xe1, 0x9b, 0x99, 0xc3, 0xbc, 0xc4, 0xad, @@ -53,16 +53,16 @@ pub(crate) const TEST_VECTORS: &[TestVector] = &[ 0x8b, 0xe2, 0xb1, 0xb4, 0xc3, 0x85, 0xc8, 0xbe, ], asset_base: [ - 0x7e, 0x46, 0xc7, 0x8d, 0xdc, 0xba, 0x48, 0x8b, 0x25, 0x91, 0xff, 0xc9, 0x35, 0x43, - 0x7e, 0x57, 0x33, 0xd7, 0xc4, 0xea, 0x10, 0x0e, 0x22, 0xca, 0x32, 0x2a, 0x7d, 0x23, - 0x1b, 0xaf, 0xc9, 0x00, + 0x83, 0x4c, 0x06, 0x47, 0x00, 0xdc, 0xee, 0xd1, 0x4d, 0xbb, 0xf7, 0x78, 0x8c, 0x6e, + 0xd2, 0x5e, 0xcd, 0x24, 0x86, 0xed, 0xc9, 0xff, 0xe0, 0xf0, 0x6a, 0x89, 0x3b, 0x20, + 0xe0, 0x0b, 0x88, 0x80, ], }, TestVector { key: [ - 0xd5, 0x9a, 0x54, 0xb2, 0x87, 0x10, 0x58, 0xe8, 0xdf, 0x0e, 0x8d, 0xb3, 0x15, 0x6f, - 0xb5, 0x60, 0xd9, 0x8d, 0xa4, 0xdb, 0x99, 0x04, 0x2c, 0xe9, 0x85, 0x2f, 0x4b, 0x08, - 0xb1, 0xf4, 0x9f, 0xaa, + 0x00, 0xd5, 0x9a, 0x54, 0xb2, 0x87, 0x10, 0x58, 0xe8, 0xdf, 0x0e, 0x8d, 0xb3, 0x15, + 0x6f, 0xb5, 0x60, 0xd9, 0x8d, 0xa4, 0xdb, 0x99, 0x04, 0x2c, 0xe9, 0x85, 0x2f, 0x4b, + 0x08, 0xb1, 0xf4, 0x9f, 0xaa, ], description: [ 0xe1, 0x9b, 0x93, 0xc6, 0xab, 0xe1, 0x9b, 0x88, 0xc2, 0xb5, 0x24, 0xc6, 0x85, 0xe2, @@ -104,16 +104,16 @@ pub(crate) const TEST_VECTORS: &[TestVector] = &[ 0x9e, 0xe1, 0x9b, 0x90, 0x4d, 0x70, 0xc8, 0xaf, ], asset_base: [ - 0xd7, 0xb2, 0xe4, 0x87, 0x84, 0x75, 0xf5, 0x3c, 0xf8, 0x91, 0x9b, 0x5b, 0x91, 0x0e, - 0x92, 0xe5, 0xb6, 0xb4, 0x23, 0x73, 0xf6, 0x2f, 0x3b, 0x1a, 0x4e, 0x20, 0xbf, 0x07, - 0x22, 0x9a, 0xdf, 0x99, + 0x4c, 0xb3, 0xb0, 0x4f, 0xb3, 0x8a, 0xc5, 0xe8, 0xa3, 0x2b, 0xcb, 0x0e, 0x99, 0xee, + 0xe8, 0xa2, 0x6c, 0x34, 0x22, 0x7f, 0x4a, 0x35, 0xad, 0xeb, 0x91, 0x14, 0xc6, 0x74, + 0x24, 0xdc, 0x1a, 0xac, ], }, TestVector { key: [ - 0x85, 0xbc, 0x7d, 0x64, 0xbe, 0x0d, 0xef, 0xc4, 0x77, 0xeb, 0x05, 0xe7, 0x95, 0xf7, - 0x69, 0x57, 0x62, 0x80, 0x02, 0x61, 0x62, 0x5a, 0x7b, 0x71, 0xa1, 0x4d, 0x18, 0xf0, - 0xef, 0x1f, 0x01, 0xb0, + 0x00, 0x85, 0xbc, 0x7d, 0x64, 0xbe, 0x0d, 0xef, 0xc4, 0x77, 0xeb, 0x05, 0xe7, 0x95, + 0xf7, 0x69, 0x57, 0x62, 0x80, 0x02, 0x61, 0x62, 0x5a, 0x7b, 0x71, 0xa1, 0x4d, 0x18, + 0xf0, 0xef, 0x1f, 0x01, 0xb0, ], description: [ 0xc7, 0x96, 0xcd, 0xb7, 0xc3, 0x9b, 0xc7, 0x8d, 0xc4, 0x92, 0x7b, 0xcd, 0xb4, 0x34, @@ -155,16 +155,16 @@ pub(crate) const TEST_VECTORS: &[TestVector] = &[ 0xc5, 0x80, 0xc3, 0xa5, 0xe1, 0x9b, 0x83, 0x5a, ], asset_base: [ - 0xa9, 0xd3, 0x61, 0x55, 0x2c, 0xe0, 0x29, 0x7b, 0x79, 0x10, 0x1c, 0xd0, 0x7e, 0xb7, - 0xf9, 0x6c, 0xbc, 0x01, 0x3f, 0xfa, 0x7d, 0xb0, 0xe2, 0x23, 0xe1, 0xb7, 0xdf, 0xb1, - 0x22, 0xe2, 0x8a, 0xb2, + 0xbb, 0x33, 0xa1, 0xb8, 0x55, 0xeb, 0x00, 0x50, 0xad, 0x02, 0xf5, 0x4b, 0xf2, 0xea, + 0x9b, 0xb2, 0x65, 0xea, 0x05, 0xd7, 0x82, 0x1d, 0x15, 0x15, 0x47, 0xe8, 0xb1, 0xa2, + 0xfc, 0x60, 0xab, 0xa1, ], }, TestVector { key: [ - 0xd7, 0x5a, 0xf5, 0x78, 0x2a, 0x5c, 0x72, 0x16, 0x38, 0xf7, 0x59, 0x32, 0x91, 0x11, - 0x49, 0x93, 0x24, 0x05, 0x3a, 0x5d, 0x1e, 0x1b, 0x2a, 0x4a, 0xb3, 0xcd, 0xf7, 0xf8, - 0x24, 0x12, 0xff, 0x42, + 0x00, 0xd7, 0x5a, 0xf5, 0x78, 0x2a, 0x5c, 0x72, 0x16, 0x38, 0xf7, 0x59, 0x32, 0x91, + 0x11, 0x49, 0x93, 0x24, 0x05, 0x3a, 0x5d, 0x1e, 0x1b, 0x2a, 0x4a, 0xb3, 0xcd, 0xf7, + 0xf8, 0x24, 0x12, 0xff, 0x42, ], description: [ 0xc3, 0xa1, 0xc7, 0xa6, 0xc4, 0xa7, 0xc5, 0xa9, 0x37, 0xc4, 0x87, 0xc7, 0xb0, 0xe1, @@ -206,16 +206,16 @@ pub(crate) const TEST_VECTORS: &[TestVector] = &[ 0xc7, 0xab, 0xc7, 0xab, 0xe2, 0xb1, 0xbb, 0x48, ], asset_base: [ - 0x01, 0x0d, 0xf0, 0x33, 0xb2, 0x76, 0xd3, 0x3c, 0x42, 0x7c, 0xa1, 0x9e, 0xae, 0x6c, - 0x57, 0xd9, 0x35, 0x78, 0x16, 0xb9, 0xc4, 0xb7, 0x52, 0xc5, 0xff, 0x8f, 0x5e, 0xa7, - 0x0b, 0x23, 0xc1, 0x8e, + 0xd7, 0x44, 0x64, 0x97, 0x40, 0x53, 0x5f, 0x38, 0xd1, 0x6e, 0x8b, 0xd6, 0x18, 0x87, + 0x02, 0xe3, 0x65, 0xa9, 0x7c, 0x18, 0x94, 0x76, 0xb4, 0xf1, 0x51, 0x00, 0x99, 0xd5, + 0xf5, 0xf8, 0x7a, 0x14, ], }, TestVector { key: [ - 0x1b, 0x39, 0xca, 0x34, 0x32, 0x36, 0xdf, 0xab, 0x88, 0xfe, 0x78, 0x12, 0x10, 0xe1, - 0xe8, 0x79, 0x29, 0x3b, 0xe0, 0xf4, 0xc5, 0x1c, 0x86, 0xfd, 0x8a, 0x6f, 0xff, 0xdb, - 0xb4, 0xad, 0x26, 0x73, + 0x00, 0x1b, 0x39, 0xca, 0x34, 0x32, 0x36, 0xdf, 0xab, 0x88, 0xfe, 0x78, 0x12, 0x10, + 0xe1, 0xe8, 0x79, 0x29, 0x3b, 0xe0, 0xf4, 0xc5, 0x1c, 0x86, 0xfd, 0x8a, 0x6f, 0xff, + 0xdb, 0xb4, 0xad, 0x26, 0x73, ], description: [ 0xe1, 0x9b, 0xa7, 0xe2, 0xb1, 0xa5, 0xc2, 0xba, 0xc6, 0x8c, 0xc3, 0x81, 0xc6, 0x82, @@ -257,16 +257,16 @@ pub(crate) const TEST_VECTORS: &[TestVector] = &[ 0xe1, 0x9b, 0x88, 0x61, 0xc6, 0xa9, 0xc4, 0xa2, ], asset_base: [ - 0xa3, 0xd7, 0x7d, 0xcd, 0xb9, 0xa7, 0xa1, 0x5a, 0x78, 0x08, 0x8c, 0xff, 0xec, 0x67, - 0x85, 0xf8, 0x26, 0x84, 0x75, 0x7c, 0x98, 0x89, 0x3d, 0x52, 0xf9, 0x3c, 0xd8, 0x09, - 0x49, 0x0f, 0x8a, 0x0e, + 0x78, 0x27, 0x9e, 0x01, 0x0c, 0x1b, 0xc4, 0x7f, 0x0f, 0x78, 0x7b, 0x42, 0x14, 0x72, + 0xfb, 0x83, 0x85, 0x94, 0xd9, 0xf7, 0xe5, 0x6e, 0xb3, 0xcc, 0x02, 0xd5, 0x9c, 0xa7, + 0xfb, 0xb8, 0x1f, 0x35, ], }, TestVector { key: [ - 0x56, 0x6e, 0x78, 0x1a, 0xc9, 0x8e, 0x99, 0x13, 0x08, 0x98, 0x1b, 0x7c, 0xdc, 0x73, - 0x7c, 0x66, 0x78, 0x5b, 0xe5, 0x31, 0xe2, 0x0a, 0xef, 0x77, 0x7a, 0xac, 0xe0, 0x6d, - 0x38, 0xfa, 0x02, 0x6b, + 0x00, 0x56, 0x6e, 0x78, 0x1a, 0xc9, 0x8e, 0x99, 0x13, 0x08, 0x98, 0x1b, 0x7c, 0xdc, + 0x73, 0x7c, 0x66, 0x78, 0x5b, 0xe5, 0x31, 0xe2, 0x0a, 0xef, 0x77, 0x7a, 0xac, 0xe0, + 0x6d, 0x38, 0xfa, 0x02, 0x6b, ], description: [ 0xc6, 0xa4, 0xc7, 0xae, 0xe1, 0x9a, 0xa6, 0xc8, 0x91, 0xc2, 0xb5, 0xc8, 0xaa, 0xc3, @@ -308,16 +308,16 @@ pub(crate) const TEST_VECTORS: &[TestVector] = &[ 0x85, 0xc6, 0xa9, 0xc7, 0xac, 0xc7, 0x9f, 0x5a, ], asset_base: [ - 0xd3, 0xd8, 0x13, 0xbb, 0xa4, 0x40, 0xb5, 0xff, 0xeb, 0x1c, 0xdd, 0x67, 0x03, 0xc7, - 0xf3, 0x45, 0xa5, 0x79, 0xc1, 0x34, 0x7c, 0xcd, 0xb5, 0x15, 0x2e, 0x89, 0x0f, 0x49, - 0x52, 0x61, 0xd4, 0x90, + 0xca, 0xf1, 0x15, 0xdf, 0xa8, 0xf1, 0x29, 0xc9, 0x80, 0xb6, 0x3e, 0xce, 0x94, 0x87, + 0x0b, 0x6a, 0x61, 0xed, 0x8f, 0x16, 0x9b, 0x4d, 0x6b, 0x1b, 0xca, 0xd6, 0x8a, 0x1d, + 0x01, 0x3c, 0x1f, 0x33, ], }, TestVector { key: [ - 0x86, 0xcc, 0x5e, 0x4f, 0xea, 0x9b, 0x7c, 0x1d, 0x0e, 0x1f, 0xa8, 0xb6, 0xa8, 0xf2, - 0x31, 0xb4, 0x56, 0x2e, 0x53, 0x89, 0xe9, 0xe7, 0x92, 0x16, 0x57, 0x67, 0x96, 0xce, - 0x3a, 0x49, 0x40, 0x6b, + 0x00, 0x86, 0xcc, 0x5e, 0x4f, 0xea, 0x9b, 0x7c, 0x1d, 0x0e, 0x1f, 0xa8, 0xb6, 0xa8, + 0xf2, 0x31, 0xb4, 0x56, 0x2e, 0x53, 0x89, 0xe9, 0xe7, 0x92, 0x16, 0x57, 0x67, 0x96, + 0xce, 0x3a, 0x49, 0x40, 0x6b, ], description: [ 0xc2, 0xa1, 0xc4, 0x8e, 0xc3, 0x9f, 0xc5, 0xbb, 0x74, 0xc4, 0x82, 0xc5, 0xbb, 0x7d, @@ -359,16 +359,16 @@ pub(crate) const TEST_VECTORS: &[TestVector] = &[ 0xcd, 0xb4, 0xc7, 0x9a, 0x3f, 0xc4, 0x85, 0x5a, ], asset_base: [ - 0x98, 0x40, 0xad, 0x9e, 0x83, 0xd6, 0xb0, 0xe1, 0xe9, 0x5b, 0x71, 0xe9, 0x01, 0x84, - 0x06, 0xea, 0x41, 0x07, 0x90, 0xfb, 0x90, 0x17, 0x38, 0xac, 0x91, 0x26, 0xe8, 0x16, - 0xf8, 0x26, 0x42, 0xb8, + 0x7d, 0x4e, 0xcd, 0xc4, 0x98, 0xd8, 0x41, 0xf6, 0x6a, 0x3e, 0xbd, 0xf4, 0xdb, 0x73, + 0x0f, 0x96, 0x7b, 0x50, 0x84, 0xc4, 0x16, 0xeb, 0x52, 0x14, 0xc7, 0xeb, 0x3a, 0xfc, + 0xea, 0x8a, 0x15, 0x22, ], }, TestVector { key: [ - 0x43, 0x39, 0xfd, 0x2a, 0x6c, 0x66, 0x30, 0x2e, 0x31, 0x8e, 0x18, 0x41, 0xf7, 0xe6, - 0x36, 0xb7, 0x76, 0x58, 0xda, 0xfc, 0x9c, 0x8e, 0x96, 0x45, 0xc9, 0x46, 0xe9, 0x5e, - 0x56, 0x9c, 0x3c, 0x45, + 0x00, 0x43, 0x39, 0xfd, 0x2a, 0x6c, 0x66, 0x30, 0x2e, 0x31, 0x8e, 0x18, 0x41, 0xf7, + 0xe6, 0x36, 0xb7, 0x76, 0x58, 0xda, 0xfc, 0x9c, 0x8e, 0x96, 0x45, 0xc9, 0x46, 0xe9, + 0x5e, 0x56, 0x9c, 0x3c, 0x45, ], description: [ 0xc9, 0x80, 0xc4, 0x80, 0xe1, 0x9a, 0xb0, 0xc4, 0xa3, 0xc6, 0x8e, 0xc5, 0xb2, 0xc6, @@ -410,16 +410,16 @@ pub(crate) const TEST_VECTORS: &[TestVector] = &[ 0xc3, 0xa7, 0x5c, 0xe1, 0x9b, 0x97, 0x47, 0x5a, ], asset_base: [ - 0xe8, 0x86, 0xd9, 0x58, 0x68, 0xa3, 0x37, 0x06, 0x45, 0xd3, 0x31, 0xb1, 0x0a, 0xcf, - 0x65, 0x20, 0x52, 0xf8, 0x82, 0x21, 0x94, 0x95, 0xd7, 0x9b, 0x76, 0x73, 0xb1, 0xb7, - 0xdd, 0x1b, 0x92, 0xaa, + 0x26, 0xec, 0x70, 0x8a, 0x9f, 0x89, 0x4e, 0xb4, 0x0f, 0xac, 0xe0, 0x84, 0xba, 0xfd, + 0xb3, 0x62, 0x2b, 0xcc, 0x30, 0xb0, 0x6b, 0x40, 0x08, 0x97, 0x50, 0xc2, 0x7a, 0x91, + 0xf3, 0x86, 0x23, 0x3a, ], }, TestVector { key: [ - 0x46, 0x2e, 0xe2, 0x38, 0x00, 0xc2, 0x1e, 0x2b, 0xbd, 0x90, 0x2b, 0xf7, 0x2f, 0x60, - 0xe1, 0xab, 0x08, 0x26, 0xd3, 0x68, 0x0c, 0x6f, 0xd0, 0xa2, 0x6f, 0x87, 0xdb, 0xac, - 0xd0, 0xd7, 0x6c, 0xa0, + 0x00, 0x46, 0x2e, 0xe2, 0x38, 0x00, 0xc2, 0x1e, 0x2b, 0xbd, 0x90, 0x2b, 0xf7, 0x2f, + 0x60, 0xe1, 0xab, 0x08, 0x26, 0xd3, 0x68, 0x0c, 0x6f, 0xd0, 0xa2, 0x6f, 0x87, 0xdb, + 0xac, 0xd0, 0xd7, 0x6c, 0xa0, ], description: [ 0xc6, 0x96, 0x5e, 0x38, 0xc5, 0xa9, 0x73, 0x21, 0xc9, 0x88, 0xcd, 0xb7, 0xc3, 0xba, @@ -461,16 +461,16 @@ pub(crate) const TEST_VECTORS: &[TestVector] = &[ 0xc3, 0xbd, 0xc3, 0xb2, 0xc8, 0x9a, 0xc8, 0x9f, ], asset_base: [ - 0x9b, 0x83, 0xfb, 0x05, 0xd3, 0x83, 0x37, 0x66, 0xcb, 0xee, 0xf1, 0xde, 0xee, 0xcb, - 0x30, 0x77, 0x76, 0x16, 0x1a, 0x24, 0xa2, 0x64, 0x15, 0x44, 0x9a, 0x63, 0xe7, 0x61, - 0x17, 0xdf, 0x9e, 0x94, + 0x6e, 0xbf, 0x7e, 0x3f, 0x99, 0x42, 0x25, 0x9e, 0x0f, 0x5f, 0x01, 0xb9, 0x7a, 0xda, + 0x67, 0xab, 0x96, 0x9b, 0x3a, 0xe5, 0x92, 0x8b, 0x62, 0x87, 0xad, 0xf9, 0xc8, 0xa6, + 0x53, 0xa2, 0x4d, 0xb4, ], }, TestVector { key: [ - 0x9e, 0x94, 0xc3, 0xbb, 0x8a, 0xb5, 0x31, 0x98, 0xd3, 0x9e, 0xf1, 0xb4, 0x05, 0xd1, - 0x75, 0x39, 0x20, 0x6f, 0x1b, 0x9f, 0x8e, 0xe9, 0xbc, 0x62, 0x58, 0xb5, 0xfe, 0xf5, - 0xb3, 0x0a, 0xb9, 0x4d, + 0x00, 0x9e, 0x94, 0xc3, 0xbb, 0x8a, 0xb5, 0x31, 0x98, 0xd3, 0x9e, 0xf1, 0xb4, 0x05, + 0xd1, 0x75, 0x39, 0x20, 0x6f, 0x1b, 0x9f, 0x8e, 0xe9, 0xbc, 0x62, 0x58, 0xb5, 0xfe, + 0xf5, 0xb3, 0x0a, 0xb9, 0x4d, ], description: [ 0x76, 0xe1, 0x9b, 0xa3, 0xc5, 0x8f, 0xc3, 0x95, 0xc6, 0xa6, 0x65, 0xc3, 0x9f, 0xc7, @@ -512,16 +512,16 @@ pub(crate) const TEST_VECTORS: &[TestVector] = &[ 0xbc, 0xc6, 0xaf, 0xc2, 0xac, 0xc9, 0x89, 0x5a, ], asset_base: [ - 0xf4, 0x50, 0x63, 0x88, 0xca, 0xcb, 0xd0, 0xe5, 0x22, 0xf5, 0x19, 0xe0, 0x0b, 0x2a, - 0x6c, 0xcc, 0x9a, 0xf4, 0x38, 0x87, 0x17, 0x71, 0xb4, 0xc2, 0xb9, 0x06, 0x92, 0x3b, - 0x32, 0xf5, 0x5b, 0xa2, + 0xaa, 0x76, 0x2e, 0x0b, 0xc9, 0xf2, 0x3b, 0x50, 0xfe, 0x68, 0x45, 0x16, 0xb3, 0xcf, + 0x00, 0x25, 0x45, 0x94, 0xc5, 0x2a, 0x5e, 0x3b, 0x3c, 0x8b, 0x88, 0xed, 0x83, 0xe1, + 0x8d, 0x03, 0x41, 0xa9, ], }, TestVector { key: [ - 0xb2, 0xa8, 0xb7, 0x91, 0x5b, 0x37, 0x72, 0x5a, 0xd1, 0xcf, 0x5d, 0xc6, 0xeb, 0x4c, - 0xd0, 0x9a, 0xf4, 0xe1, 0x87, 0xf8, 0xcf, 0x27, 0x37, 0xed, 0x33, 0x7c, 0x77, 0x6e, - 0x93, 0xe2, 0xa0, 0x89, + 0x00, 0xb2, 0xa8, 0xb7, 0x91, 0x5b, 0x37, 0x72, 0x5a, 0xd1, 0xcf, 0x5d, 0xc6, 0xeb, + 0x4c, 0xd0, 0x9a, 0xf4, 0xe1, 0x87, 0xf8, 0xcf, 0x27, 0x37, 0xed, 0x33, 0x7c, 0x77, + 0x6e, 0x93, 0xe2, 0xa0, 0x89, ], description: [ 0xe1, 0x9a, 0xa7, 0x70, 0xc6, 0xa8, 0xe1, 0x9b, 0x9a, 0xe1, 0x9b, 0xa2, 0xc5, 0xad, @@ -563,16 +563,16 @@ pub(crate) const TEST_VECTORS: &[TestVector] = &[ 0xc4, 0x94, 0xc5, 0x80, 0xc8, 0x96, 0xc6, 0xb3, ], asset_base: [ - 0x5a, 0x04, 0x3d, 0x99, 0x0d, 0xb1, 0x1b, 0x51, 0x60, 0x67, 0x24, 0xe2, 0xdf, 0x9e, - 0x5b, 0xf3, 0xe6, 0x6a, 0xef, 0x7a, 0x89, 0xee, 0xb6, 0x01, 0x0b, 0xfc, 0x35, 0x76, - 0xb8, 0xc9, 0x84, 0x3d, + 0x85, 0x8e, 0xf9, 0x01, 0x47, 0x6e, 0x97, 0x36, 0xff, 0x2d, 0xc8, 0x42, 0x6c, 0x6f, + 0xdd, 0x8a, 0xe7, 0x53, 0x4e, 0xd5, 0xd1, 0x1c, 0xc5, 0x67, 0xd6, 0xf9, 0x4c, 0xe7, + 0x66, 0xec, 0x68, 0xb0, ], }, TestVector { key: [ - 0xe6, 0xdf, 0x3e, 0xbc, 0x84, 0x4c, 0x0c, 0x39, 0xcb, 0x25, 0xac, 0x91, 0xd6, 0xc1, - 0xd9, 0x20, 0x0f, 0x18, 0xfa, 0x7e, 0x8c, 0x93, 0x4c, 0x4d, 0x0c, 0x30, 0x9d, 0x79, - 0xb0, 0x4a, 0xb4, 0x43, + 0x00, 0xe6, 0xdf, 0x3e, 0xbc, 0x84, 0x4c, 0x0c, 0x39, 0xcb, 0x25, 0xac, 0x91, 0xd6, + 0xc1, 0xd9, 0x20, 0x0f, 0x18, 0xfa, 0x7e, 0x8c, 0x93, 0x4c, 0x4d, 0x0c, 0x30, 0x9d, + 0x79, 0xb0, 0x4a, 0xb4, 0x43, ], description: [ 0xe1, 0x9a, 0xa5, 0xc4, 0x80, 0xc3, 0x85, 0xc5, 0xa4, 0xc5, 0xbb, 0xc7, 0xbf, 0x34, @@ -614,16 +614,16 @@ pub(crate) const TEST_VECTORS: &[TestVector] = &[ 0xb2, 0xc6, 0xb9, 0xc3, 0xb5, 0x74, 0xc2, 0xb3, ], asset_base: [ - 0x10, 0xa8, 0xbf, 0xf0, 0xed, 0x13, 0xb3, 0xc9, 0x10, 0x26, 0x17, 0xb2, 0x7c, 0xe8, - 0x51, 0x76, 0x2b, 0x0b, 0xa0, 0xb0, 0x92, 0x4f, 0xc2, 0x02, 0xae, 0x17, 0x95, 0x7f, - 0x27, 0xc8, 0xc6, 0x99, + 0x8f, 0xf5, 0x4f, 0x73, 0x34, 0xb8, 0x9a, 0x41, 0x5a, 0xcf, 0xad, 0x33, 0x91, 0xc0, + 0x29, 0x12, 0x1b, 0xea, 0x90, 0xb9, 0x55, 0x08, 0x9b, 0x00, 0x97, 0xe1, 0x09, 0xbb, + 0xd0, 0x77, 0x69, 0x11, ], }, TestVector { key: [ - 0xdb, 0x1f, 0x0a, 0x56, 0x5c, 0x8c, 0x06, 0xa6, 0x3d, 0x4f, 0x75, 0x92, 0x62, 0x55, - 0xf4, 0xfa, 0x3c, 0x76, 0x44, 0x23, 0xc0, 0x49, 0x55, 0x02, 0x4e, 0xa0, 0x3b, 0xba, - 0x63, 0x63, 0x6c, 0x55, + 0x00, 0xdb, 0x1f, 0x0a, 0x56, 0x5c, 0x8c, 0x06, 0xa6, 0x3d, 0x4f, 0x75, 0x92, 0x62, + 0x55, 0xf4, 0xfa, 0x3c, 0x76, 0x44, 0x23, 0xc0, 0x49, 0x55, 0x02, 0x4e, 0xa0, 0x3b, + 0xba, 0x63, 0x63, 0x6c, 0x55, ], description: [ 0xc6, 0xa7, 0xe1, 0x9b, 0x8e, 0xc6, 0x8d, 0xc6, 0x88, 0xc2, 0xa3, 0xc4, 0xbe, 0xc6, @@ -665,16 +665,16 @@ pub(crate) const TEST_VECTORS: &[TestVector] = &[ 0xcd, 0xbc, 0xe1, 0x9a, 0xbc, 0xe2, 0xb1, 0xa8, ], asset_base: [ - 0xec, 0x69, 0x43, 0x25, 0xaf, 0x69, 0x09, 0x19, 0x89, 0x0c, 0x98, 0xf2, 0x1e, 0x68, - 0x0f, 0x6f, 0xce, 0x19, 0x3e, 0x83, 0x20, 0x86, 0xe3, 0xe3, 0x75, 0xc4, 0x2a, 0x31, - 0xbd, 0x8d, 0x4d, 0xb7, + 0x21, 0xde, 0x1c, 0xdd, 0x66, 0x54, 0xd4, 0x5a, 0xc5, 0x57, 0x7b, 0x81, 0x6f, 0x29, + 0x8f, 0x78, 0x88, 0x59, 0x9d, 0xbb, 0xa5, 0xa5, 0xd5, 0x31, 0xe9, 0x85, 0x1a, 0x13, + 0x91, 0xbd, 0x60, 0x0b, ], }, TestVector { key: [ - 0x98, 0x9f, 0xc7, 0x01, 0x45, 0xd2, 0xfb, 0xb4, 0xd2, 0xe2, 0x79, 0xe5, 0xf9, 0x5d, - 0x72, 0x9f, 0x6a, 0xf4, 0xe9, 0x83, 0x28, 0x53, 0xf5, 0x97, 0xaf, 0x2f, 0xfb, 0xfb, - 0x88, 0xa6, 0x6e, 0xba, + 0x00, 0x98, 0x9f, 0xc7, 0x01, 0x45, 0xd2, 0xfb, 0xb4, 0xd2, 0xe2, 0x79, 0xe5, 0xf9, + 0x5d, 0x72, 0x9f, 0x6a, 0xf4, 0xe9, 0x83, 0x28, 0x53, 0xf5, 0x97, 0xaf, 0x2f, 0xfb, + 0xfb, 0x88, 0xa6, 0x6e, 0xba, ], description: [ 0xce, 0x8a, 0xc7, 0xb5, 0xc7, 0xbd, 0xc2, 0xae, 0x66, 0xc6, 0xbd, 0xc8, 0xa0, 0xc7, @@ -716,16 +716,16 @@ pub(crate) const TEST_VECTORS: &[TestVector] = &[ 0x87, 0xe2, 0xb1, 0xbd, 0xc8, 0x8f, 0xc9, 0x8c, ], asset_base: [ - 0x00, 0xd1, 0x7f, 0x46, 0x6a, 0x46, 0x7a, 0x61, 0x3b, 0x6e, 0xe2, 0x24, 0x85, 0xe3, - 0xa8, 0x9c, 0x86, 0xcc, 0x8d, 0x1a, 0xf3, 0x7b, 0xdb, 0x5b, 0x01, 0xa0, 0x9f, 0x6b, - 0x13, 0xfc, 0x74, 0x85, + 0x97, 0x57, 0x87, 0x2a, 0x0f, 0x06, 0x4f, 0x52, 0x78, 0x62, 0x64, 0x7b, 0x8d, 0x05, + 0xf8, 0xb8, 0x43, 0xe7, 0x82, 0x04, 0xbc, 0xa1, 0x51, 0xa9, 0x69, 0xd5, 0x99, 0x40, + 0xb3, 0xa6, 0x23, 0x04, ], }, TestVector { key: [ - 0x1d, 0xa0, 0x2d, 0x7e, 0x6a, 0x75, 0x4b, 0xe4, 0xde, 0xfa, 0x04, 0x90, 0x29, 0xc7, - 0x94, 0x8b, 0x5e, 0xd2, 0x5b, 0x4d, 0x22, 0xbf, 0x87, 0x27, 0x0b, 0x9d, 0x32, 0xda, - 0x52, 0x81, 0x92, 0x24, + 0x00, 0x1d, 0xa0, 0x2d, 0x7e, 0x6a, 0x75, 0x4b, 0xe4, 0xde, 0xfa, 0x04, 0x90, 0x29, + 0xc7, 0x94, 0x8b, 0x5e, 0xd2, 0x5b, 0x4d, 0x22, 0xbf, 0x87, 0x27, 0x0b, 0x9d, 0x32, + 0xda, 0x52, 0x81, 0x92, 0x24, ], description: [ 0xe1, 0x9b, 0x9c, 0xe1, 0x9a, 0xa5, 0xc5, 0xb7, 0x2b, 0xc3, 0x81, 0xc3, 0x8d, 0xc8, @@ -767,16 +767,16 @@ pub(crate) const TEST_VECTORS: &[TestVector] = &[ 0xc7, 0xab, 0xc5, 0x92, 0xc8, 0x8c, 0x5a, 0x5a, ], asset_base: [ - 0x89, 0x29, 0x91, 0xc7, 0xbe, 0xb5, 0x25, 0x9d, 0xc4, 0xc9, 0x9c, 0x2e, 0x6d, 0x34, - 0x93, 0x87, 0x01, 0x56, 0x06, 0x27, 0x1b, 0x9c, 0xb0, 0x23, 0xb1, 0x1b, 0xb8, 0xa9, - 0xdf, 0x99, 0xc1, 0x25, + 0xed, 0xa1, 0x59, 0x95, 0x48, 0x4d, 0x4e, 0x29, 0x81, 0xa7, 0xbc, 0xb1, 0xe1, 0xaa, + 0x35, 0xf0, 0x51, 0x60, 0x10, 0x7a, 0xcd, 0xa2, 0x1f, 0x60, 0xc1, 0xca, 0x47, 0xed, + 0x28, 0x9c, 0xa3, 0x96, ], }, TestVector { key: [ - 0x72, 0xab, 0x8e, 0x45, 0x8e, 0xd4, 0xc8, 0xf2, 0xc5, 0xba, 0xa1, 0x18, 0x50, 0xac, - 0xff, 0x71, 0x55, 0xd6, 0xad, 0x0d, 0xc9, 0x81, 0x55, 0x7b, 0x0a, 0x63, 0xab, 0xcb, - 0xf4, 0xa6, 0x8d, 0xe3, + 0x00, 0x72, 0xab, 0x8e, 0x45, 0x8e, 0xd4, 0xc8, 0xf2, 0xc5, 0xba, 0xa1, 0x18, 0x50, + 0xac, 0xff, 0x71, 0x55, 0xd6, 0xad, 0x0d, 0xc9, 0x81, 0x55, 0x7b, 0x0a, 0x63, 0xab, + 0xcb, 0xf4, 0xa6, 0x8d, 0xe3, ], description: [ 0x6d, 0xc3, 0xbf, 0xc7, 0xa9, 0xc6, 0x93, 0xc4, 0x8b, 0xc4, 0xb2, 0xc8, 0xba, 0xc6, @@ -818,16 +818,16 @@ pub(crate) const TEST_VECTORS: &[TestVector] = &[ 0xe2, 0xb1, 0xa5, 0xc8, 0x82, 0xc7, 0x8b, 0x5a, ], asset_base: [ - 0x65, 0xf8, 0x13, 0xc3, 0x65, 0x97, 0x2b, 0xbb, 0x33, 0xfc, 0x35, 0x17, 0x0e, 0x95, - 0x4f, 0xb0, 0x7c, 0x89, 0x94, 0x24, 0xca, 0x6a, 0x48, 0x2b, 0xce, 0x0d, 0x6d, 0x26, - 0x58, 0x71, 0x1b, 0xbe, + 0xef, 0xe9, 0xdd, 0x3a, 0x41, 0x31, 0x01, 0x12, 0x3e, 0xfa, 0xe1, 0x75, 0xc2, 0xf0, + 0x1f, 0x94, 0x96, 0x01, 0x16, 0x69, 0xf4, 0xe6, 0x11, 0xd0, 0xcc, 0x3e, 0xf7, 0x4a, + 0x8d, 0xc6, 0x4c, 0xbe, ], }, TestVector { key: [ - 0x0e, 0xf9, 0x1a, 0x2b, 0x56, 0xac, 0x5f, 0x19, 0xd1, 0xc9, 0xfb, 0x24, 0x98, 0x6c, - 0x01, 0x36, 0x2d, 0x66, 0x39, 0x16, 0x0c, 0x27, 0x5b, 0x28, 0x02, 0x46, 0x50, 0x05, - 0x14, 0x96, 0x98, 0x44, + 0x00, 0x0e, 0xf9, 0x1a, 0x2b, 0x56, 0xac, 0x5f, 0x19, 0xd1, 0xc9, 0xfb, 0x24, 0x98, + 0x6c, 0x01, 0x36, 0x2d, 0x66, 0x39, 0x16, 0x0c, 0x27, 0x5b, 0x28, 0x02, 0x46, 0x50, + 0x05, 0x14, 0x96, 0x98, 0x44, ], description: [ 0x49, 0xc2, 0xa7, 0xc3, 0xb0, 0x67, 0xe1, 0x9b, 0xa1, 0xc6, 0xa6, 0xc6, 0x95, 0xe1, @@ -869,16 +869,16 @@ pub(crate) const TEST_VECTORS: &[TestVector] = &[ 0xc5, 0x91, 0xc9, 0x8c, 0xc2, 0xab, 0xc6, 0x9d, ], asset_base: [ - 0xb6, 0xff, 0xe5, 0x46, 0x67, 0xba, 0xd3, 0x36, 0x0f, 0xf9, 0x7c, 0x51, 0xbc, 0x63, - 0xd0, 0x99, 0x70, 0xcf, 0x40, 0xbe, 0x92, 0x0a, 0xd0, 0x1c, 0x72, 0x40, 0x42, 0x0d, - 0x82, 0xb7, 0x1b, 0x0f, + 0x7c, 0xdd, 0x49, 0x85, 0xc5, 0xcd, 0x72, 0xf9, 0x2d, 0x4c, 0x40, 0xa7, 0xa2, 0x56, + 0x74, 0xdc, 0x53, 0x16, 0x7a, 0x99, 0xed, 0x62, 0xe8, 0x5a, 0xe9, 0x98, 0x59, 0x70, + 0xb1, 0x93, 0x47, 0x00, ], }, TestVector { key: [ - 0x0b, 0x08, 0x3c, 0x42, 0x29, 0xbd, 0x05, 0x85, 0xa4, 0xa0, 0xf5, 0xe8, 0x06, 0x55, - 0x2b, 0x65, 0xee, 0x24, 0xc7, 0x1a, 0x4a, 0x2a, 0x19, 0x7f, 0x9e, 0x85, 0x5e, 0xdc, - 0x2e, 0x1a, 0x09, 0xfa, + 0x00, 0x0b, 0x08, 0x3c, 0x42, 0x29, 0xbd, 0x05, 0x85, 0xa4, 0xa0, 0xf5, 0xe8, 0x06, + 0x55, 0x2b, 0x65, 0xee, 0x24, 0xc7, 0x1a, 0x4a, 0x2a, 0x19, 0x7f, 0x9e, 0x85, 0x5e, + 0xdc, 0x2e, 0x1a, 0x09, 0xfa, ], description: [ 0xc5, 0xa0, 0x2a, 0xc4, 0xbc, 0xc6, 0x92, 0xc6, 0x9b, 0xc6, 0x9f, 0xe1, 0x9b, 0xaf, @@ -920,16 +920,16 @@ pub(crate) const TEST_VECTORS: &[TestVector] = &[ 0xc5, 0x91, 0x75, 0xc7, 0xbd, 0xe1, 0x9a, 0xb4, ], asset_base: [ - 0xde, 0x6b, 0x80, 0x19, 0x0e, 0x59, 0x02, 0x25, 0x7b, 0x37, 0xf0, 0xaa, 0xf0, 0xc4, - 0x68, 0xb0, 0xee, 0xa6, 0x20, 0x24, 0x29, 0x8f, 0xe6, 0xaa, 0x54, 0x2e, 0xf4, 0x67, - 0x8a, 0x88, 0x9f, 0xb0, + 0xe9, 0x33, 0x51, 0xd8, 0x60, 0x24, 0xc7, 0x99, 0xad, 0x70, 0x41, 0xe4, 0x13, 0x87, + 0x2c, 0x6b, 0x77, 0xb0, 0x09, 0x15, 0x9f, 0x90, 0x49, 0xed, 0xdc, 0x5f, 0x00, 0x4a, + 0x9c, 0x04, 0xfb, 0xb8, ], }, TestVector { key: [ - 0x02, 0x66, 0x60, 0x55, 0xf4, 0x0b, 0x89, 0x61, 0x24, 0xe3, 0x67, 0x56, 0xa7, 0xa0, - 0x93, 0xbb, 0x8e, 0x0b, 0xaa, 0x26, 0x3c, 0xab, 0x79, 0x67, 0x3b, 0x0f, 0x3d, 0x09, - 0x74, 0x68, 0x8e, 0xa1, + 0x00, 0x02, 0x66, 0x60, 0x55, 0xf4, 0x0b, 0x89, 0x61, 0x24, 0xe3, 0x67, 0x56, 0xa7, + 0xa0, 0x93, 0xbb, 0x8e, 0x0b, 0xaa, 0x26, 0x3c, 0xab, 0x79, 0x67, 0x3b, 0x0f, 0x3d, + 0x09, 0x74, 0x68, 0x8e, 0xa1, ], description: [ 0xc7, 0xac, 0xc3, 0xa5, 0xc7, 0xa7, 0x62, 0xc3, 0xb5, 0x4d, 0xc6, 0x80, 0xc3, 0x83, @@ -971,16 +971,16 @@ pub(crate) const TEST_VECTORS: &[TestVector] = &[ 0xe2, 0xb1, 0xb3, 0x47, 0xc6, 0xbb, 0xc8, 0x83, ], asset_base: [ - 0xb3, 0xab, 0xd0, 0x61, 0x3b, 0xd2, 0xa7, 0xa8, 0xf6, 0x74, 0x33, 0x6f, 0x0f, 0xdf, - 0x2c, 0x3b, 0x08, 0x16, 0xee, 0x04, 0x1c, 0x85, 0x04, 0xb4, 0x45, 0xcc, 0xe1, 0x53, - 0x15, 0x46, 0xc8, 0x1c, + 0xe2, 0x5b, 0x76, 0x27, 0xb4, 0x2b, 0x0d, 0xa2, 0x38, 0xdb, 0xc4, 0x38, 0xfb, 0x09, + 0xdc, 0x6c, 0xcd, 0x8d, 0x54, 0xb2, 0xfa, 0xa6, 0x5b, 0x30, 0xf8, 0x02, 0xcd, 0x39, + 0x29, 0x9a, 0xc6, 0x27, ], }, TestVector { key: [ - 0x0a, 0xc2, 0x8d, 0x35, 0x85, 0x55, 0x65, 0x95, 0xac, 0x16, 0x8a, 0x8c, 0xa3, 0xa0, - 0x63, 0x31, 0x9c, 0xdf, 0xbb, 0x4f, 0xaf, 0x2c, 0xa2, 0x48, 0x1d, 0x4d, 0xaa, 0x04, - 0x2d, 0x7c, 0xad, 0xa5, + 0x00, 0x0a, 0xc2, 0x8d, 0x35, 0x85, 0x55, 0x65, 0x95, 0xac, 0x16, 0x8a, 0x8c, 0xa3, + 0xa0, 0x63, 0x31, 0x9c, 0xdf, 0xbb, 0x4f, 0xaf, 0x2c, 0xa2, 0x48, 0x1d, 0x4d, 0xaa, + 0x04, 0x2d, 0x7c, 0xad, 0xa5, ], description: [ 0xe2, 0xb1, 0xb0, 0xc6, 0x87, 0xc7, 0xb8, 0x58, 0xc8, 0x93, 0xe1, 0x9a, 0xb6, 0xc5, @@ -1022,9 +1022,9 @@ pub(crate) const TEST_VECTORS: &[TestVector] = &[ 0xc2, 0xa9, 0xc5, 0x89, 0xc8, 0xb5, 0x5a, 0x5a, ], asset_base: [ - 0x38, 0x52, 0x49, 0x24, 0x7a, 0xb3, 0x96, 0xdb, 0xd5, 0x07, 0x83, 0xa3, 0x51, 0xf6, - 0xbe, 0x50, 0x80, 0x3e, 0xf4, 0x4b, 0x2c, 0x29, 0x82, 0xbc, 0xdd, 0x81, 0xe7, 0x72, - 0x44, 0xbd, 0xa6, 0x8c, + 0x87, 0x4a, 0x3c, 0x3d, 0x56, 0xc1, 0x2e, 0xa1, 0x10, 0x33, 0x73, 0x08, 0x00, 0x2e, + 0x75, 0xc6, 0xe7, 0xb3, 0x48, 0x53, 0x8d, 0xea, 0x65, 0x5e, 0xbf, 0xf4, 0xe1, 0x85, + 0x19, 0x66, 0x51, 0x95, ], }, ]; diff --git a/src/test_vectors/issuance_auth_sig.rs b/src/test_vectors/issuance_auth_sig.rs index a9d250b37..75bff3e91 100644 --- a/src/test_vectors/issuance_auth_sig.rs +++ b/src/test_vectors/issuance_auth_sig.rs @@ -2,9 +2,9 @@ pub(crate) struct TestVector { pub(crate) isk: [u8; 32], - pub(crate) ik: [u8; 32], + pub(crate) ik: [u8; 33], pub(crate) msg: [u8; 32], - pub(crate) sig: [u8; 64], + pub(crate) sig: [u8; 65], } pub(crate) const TEST_VECTORS: &[TestVector] = &[ @@ -15,9 +15,9 @@ pub(crate) const TEST_VECTORS: &[TestVector] = &[ 0x00, 0x00, 0x00, 0x03, ], ik: [ - 0xf9, 0x30, 0x8a, 0x01, 0x92, 0x58, 0xc3, 0x10, 0x49, 0x34, 0x4f, 0x85, 0xf8, 0x9d, - 0x52, 0x29, 0xb5, 0x31, 0xc8, 0x45, 0x83, 0x6f, 0x99, 0xb0, 0x86, 0x01, 0xf1, 0x13, - 0xbc, 0xe0, 0x36, 0xf9, + 0x00, 0xf9, 0x30, 0x8a, 0x01, 0x92, 0x58, 0xc3, 0x10, 0x49, 0x34, 0x4f, 0x85, 0xf8, + 0x9d, 0x52, 0x29, 0xb5, 0x31, 0xc8, 0x45, 0x83, 0x6f, 0x99, 0xb0, 0x86, 0x01, 0xf1, + 0x13, 0xbc, 0xe0, 0x36, 0xf9, ], msg: [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -25,11 +25,11 @@ pub(crate) const TEST_VECTORS: &[TestVector] = &[ 0x00, 0x00, 0x00, 0x00, ], sig: [ - 0xe9, 0x07, 0x83, 0x1f, 0x80, 0x84, 0x8d, 0x10, 0x69, 0xa5, 0x37, 0x1b, 0x40, 0x24, - 0x10, 0x36, 0x4b, 0xdf, 0x1c, 0x5f, 0x83, 0x07, 0xb0, 0x08, 0x4c, 0x55, 0xf1, 0xce, - 0x2d, 0xca, 0x82, 0x15, 0x25, 0xf6, 0x6a, 0x4a, 0x85, 0xea, 0x8b, 0x71, 0xe4, 0x82, - 0xa7, 0x4f, 0x38, 0x2d, 0x2c, 0xe5, 0xeb, 0xee, 0xe8, 0xfd, 0xb2, 0x17, 0x2f, 0x47, - 0x7d, 0xf4, 0x90, 0x0d, 0x31, 0x05, 0x36, 0xc0, + 0x00, 0xe9, 0x07, 0x83, 0x1f, 0x80, 0x84, 0x8d, 0x10, 0x69, 0xa5, 0x37, 0x1b, 0x40, + 0x24, 0x10, 0x36, 0x4b, 0xdf, 0x1c, 0x5f, 0x83, 0x07, 0xb0, 0x08, 0x4c, 0x55, 0xf1, + 0xce, 0x2d, 0xca, 0x82, 0x15, 0x25, 0xf6, 0x6a, 0x4a, 0x85, 0xea, 0x8b, 0x71, 0xe4, + 0x82, 0xa7, 0x4f, 0x38, 0x2d, 0x2c, 0xe5, 0xeb, 0xee, 0xe8, 0xfd, 0xb2, 0x17, 0x2f, + 0x47, 0x7d, 0xf4, 0x90, 0x0d, 0x31, 0x05, 0x36, 0xc0, ], }, TestVector { @@ -39,9 +39,9 @@ pub(crate) const TEST_VECTORS: &[TestVector] = &[ 0xee, 0x69, 0x21, 0x48, ], ik: [ - 0x4b, 0xec, 0xe1, 0xff, 0x00, 0xe2, 0xed, 0x77, 0x64, 0xae, 0x6b, 0xe2, 0x0d, 0x2f, - 0x67, 0x22, 0x04, 0xfc, 0x86, 0xcc, 0xed, 0xd6, 0xfc, 0x1f, 0x71, 0xdf, 0x02, 0xc7, - 0x51, 0x6d, 0x9f, 0x31, + 0x00, 0x4b, 0xec, 0xe1, 0xff, 0x00, 0xe2, 0xed, 0x77, 0x64, 0xae, 0x6b, 0xe2, 0x0d, + 0x2f, 0x67, 0x22, 0x04, 0xfc, 0x86, 0xcc, 0xed, 0xd6, 0xfc, 0x1f, 0x71, 0xdf, 0x02, + 0xc7, 0x51, 0x6d, 0x9f, 0x31, ], msg: [ 0x1c, 0xdd, 0x86, 0xb3, 0xcc, 0x43, 0x18, 0xd9, 0x61, 0x4f, 0xc8, 0x20, 0x90, 0x5d, @@ -49,11 +49,11 @@ pub(crate) const TEST_VECTORS: &[TestVector] = &[ 0xcf, 0xb1, 0xcd, 0x8d, ], sig: [ - 0xa5, 0xb5, 0x92, 0x78, 0x1b, 0xeb, 0x55, 0xee, 0xbf, 0x8b, 0xc2, 0xbf, 0xd7, 0x9d, - 0xa9, 0x45, 0x2d, 0xc9, 0x22, 0x39, 0x87, 0x7e, 0xb7, 0xe1, 0xf5, 0x64, 0x65, 0xff, - 0x11, 0x1e, 0x59, 0x08, 0xde, 0xac, 0x15, 0xd5, 0x69, 0x99, 0x9a, 0x2b, 0xd2, 0x2b, - 0x2e, 0xf6, 0x01, 0xc5, 0x81, 0x3b, 0xdb, 0xba, 0x99, 0x3c, 0x08, 0xd4, 0xe8, 0x56, - 0xc9, 0x26, 0xd9, 0xe2, 0xc0, 0x63, 0x93, 0x67, + 0x00, 0xa5, 0xb5, 0x92, 0x78, 0x1b, 0xeb, 0x55, 0xee, 0xbf, 0x8b, 0xc2, 0xbf, 0xd7, + 0x9d, 0xa9, 0x45, 0x2d, 0xc9, 0x22, 0x39, 0x87, 0x7e, 0xb7, 0xe1, 0xf5, 0x64, 0x65, + 0xff, 0x11, 0x1e, 0x59, 0x08, 0xde, 0xac, 0x15, 0xd5, 0x69, 0x99, 0x9a, 0x2b, 0xd2, + 0x2b, 0x2e, 0xf6, 0x01, 0xc5, 0x81, 0x3b, 0xdb, 0xba, 0x99, 0x3c, 0x08, 0xd4, 0xe8, + 0x56, 0xc9, 0x26, 0xd9, 0xe2, 0xc0, 0x63, 0x93, 0x67, ], }, TestVector { @@ -63,9 +63,9 @@ pub(crate) const TEST_VECTORS: &[TestVector] = &[ 0x30, 0xa7, 0x35, 0x94, ], ik: [ - 0xd4, 0x22, 0x9e, 0x19, 0x5e, 0x25, 0xf6, 0x02, 0xa2, 0x18, 0x61, 0x22, 0xcb, 0x4e, - 0x78, 0x76, 0x7b, 0x3c, 0x66, 0xac, 0x39, 0x08, 0x08, 0xd2, 0xd1, 0xb4, 0x04, 0x42, - 0xda, 0x7f, 0x00, 0x66, + 0x00, 0xd4, 0x22, 0x9e, 0x19, 0x5e, 0x25, 0xf6, 0x02, 0xa2, 0x18, 0x61, 0x22, 0xcb, + 0x4e, 0x78, 0x76, 0x7b, 0x3c, 0x66, 0xac, 0x39, 0x08, 0x08, 0xd2, 0xd1, 0xb4, 0x04, + 0x42, 0xda, 0x7f, 0x00, 0x66, ], msg: [ 0xbf, 0x50, 0x98, 0x42, 0x1c, 0x69, 0x37, 0x8a, 0xf1, 0xe4, 0x0f, 0x64, 0xe1, 0x25, @@ -73,11 +73,11 @@ pub(crate) const TEST_VECTORS: &[TestVector] = &[ 0x2a, 0x63, 0x81, 0xce, ], sig: [ - 0x18, 0x8b, 0x15, 0x57, 0x42, 0x87, 0x83, 0x55, 0x6b, 0x66, 0x80, 0x3b, 0xf9, 0x06, - 0x63, 0xb7, 0xa1, 0x6d, 0x43, 0x76, 0x92, 0x7c, 0x58, 0x35, 0xe0, 0xb7, 0x26, 0x52, - 0x0e, 0xb2, 0x6d, 0x53, 0x24, 0x99, 0x10, 0xc3, 0x9c, 0x5f, 0x05, 0x90, 0xb6, 0xd6, - 0xaa, 0xb3, 0x51, 0xff, 0x8c, 0xd8, 0xe0, 0x63, 0xfa, 0x74, 0x20, 0x42, 0x55, 0xda, - 0xdc, 0x00, 0xd9, 0xe0, 0xdf, 0xf7, 0x7b, 0x09, + 0x00, 0x18, 0x8b, 0x15, 0x57, 0x42, 0x87, 0x83, 0x55, 0x6b, 0x66, 0x80, 0x3b, 0xf9, + 0x06, 0x63, 0xb7, 0xa1, 0x6d, 0x43, 0x76, 0x92, 0x7c, 0x58, 0x35, 0xe0, 0xb7, 0x26, + 0x52, 0x0e, 0xb2, 0x6d, 0x53, 0x24, 0x99, 0x10, 0xc3, 0x9c, 0x5f, 0x05, 0x90, 0xb6, + 0xd6, 0xaa, 0xb3, 0x51, 0xff, 0x8c, 0xd8, 0xe0, 0x63, 0xfa, 0x74, 0x20, 0x42, 0x55, + 0xda, 0xdc, 0x00, 0xd9, 0xe0, 0xdf, 0xf7, 0x7b, 0x09, ], }, TestVector { @@ -87,9 +87,9 @@ pub(crate) const TEST_VECTORS: &[TestVector] = &[ 0xd5, 0x9a, 0xf8, 0x0d, ], ik: [ - 0xce, 0xb7, 0x5a, 0x43, 0x9f, 0xf0, 0x16, 0x15, 0x80, 0xbf, 0x29, 0x57, 0x24, 0xc6, - 0xd9, 0x2d, 0x31, 0xb7, 0xaa, 0x02, 0x84, 0x03, 0x39, 0x44, 0x49, 0x64, 0x48, 0x6f, - 0xae, 0xa8, 0x90, 0xe5, + 0x00, 0xce, 0xb7, 0x5a, 0x43, 0x9f, 0xf0, 0x16, 0x15, 0x80, 0xbf, 0x29, 0x57, 0x24, + 0xc6, 0xd9, 0x2d, 0x31, 0xb7, 0xaa, 0x02, 0x84, 0x03, 0x39, 0x44, 0x49, 0x64, 0x48, + 0x6f, 0xae, 0xa8, 0x90, 0xe5, ], msg: [ 0x06, 0xa7, 0x45, 0xf4, 0x4a, 0xb0, 0x23, 0x75, 0x2c, 0xb5, 0xb4, 0x06, 0xed, 0x89, @@ -97,11 +97,11 @@ pub(crate) const TEST_VECTORS: &[TestVector] = &[ 0xcc, 0xb8, 0xf6, 0x76, ], sig: [ - 0x6e, 0x5e, 0xd6, 0x65, 0x6c, 0x32, 0x71, 0x32, 0xb1, 0x65, 0x81, 0x06, 0x2f, 0x1b, - 0x13, 0x8a, 0xcc, 0x6f, 0x1f, 0x83, 0x43, 0xed, 0x9d, 0x89, 0xab, 0x5f, 0xd9, 0x38, - 0xe4, 0xe6, 0xce, 0xf7, 0x99, 0xa2, 0x25, 0x1c, 0xa5, 0x2d, 0x60, 0x82, 0x0e, 0x51, - 0x00, 0x25, 0x06, 0x7d, 0xcd, 0x1b, 0xf7, 0x54, 0xc5, 0xbf, 0xf1, 0x39, 0xb4, 0xcc, - 0x44, 0xb3, 0x7d, 0x27, 0xd1, 0x7c, 0x4a, 0xee, + 0x00, 0x6e, 0x5e, 0xd6, 0x65, 0x6c, 0x32, 0x71, 0x32, 0xb1, 0x65, 0x81, 0x06, 0x2f, + 0x1b, 0x13, 0x8a, 0xcc, 0x6f, 0x1f, 0x83, 0x43, 0xed, 0x9d, 0x89, 0xab, 0x5f, 0xd9, + 0x38, 0xe4, 0xe6, 0xce, 0xf7, 0x99, 0xa2, 0x25, 0x1c, 0xa5, 0x2d, 0x60, 0x82, 0x0e, + 0x51, 0x00, 0x25, 0x06, 0x7d, 0xcd, 0x1b, 0xf7, 0x54, 0xc5, 0xbf, 0xf1, 0x39, 0xb4, + 0xcc, 0x44, 0xb3, 0x7d, 0x27, 0xd1, 0x7c, 0x4a, 0xee, ], }, TestVector { @@ -111,9 +111,9 @@ pub(crate) const TEST_VECTORS: &[TestVector] = &[ 0x94, 0x90, 0x3d, 0x3c, ], ik: [ - 0xb0, 0xfa, 0x9d, 0x77, 0xfc, 0xbd, 0x96, 0x45, 0x91, 0x32, 0xe3, 0x05, 0xe3, 0x24, - 0xe7, 0x93, 0x6a, 0xe1, 0x3b, 0x15, 0x14, 0x7e, 0x20, 0x5d, 0x7b, 0xae, 0x42, 0xfa, - 0x7f, 0xaf, 0x5d, 0x1e, + 0x00, 0xb0, 0xfa, 0x9d, 0x77, 0xfc, 0xbd, 0x96, 0x45, 0x91, 0x32, 0xe3, 0x05, 0xe3, + 0x24, 0xe7, 0x93, 0x6a, 0xe1, 0x3b, 0x15, 0x14, 0x7e, 0x20, 0x5d, 0x7b, 0xae, 0x42, + 0xfa, 0x7f, 0xaf, 0x5d, 0x1e, ], msg: [ 0x3e, 0x0a, 0xd3, 0x36, 0x0c, 0x1d, 0x37, 0x10, 0xac, 0xd2, 0x0b, 0x18, 0x3e, 0x31, @@ -121,11 +121,11 @@ pub(crate) const TEST_VECTORS: &[TestVector] = &[ 0xe3, 0x4a, 0x98, 0x51, ], sig: [ - 0x17, 0xc2, 0xe5, 0xdf, 0x2e, 0xa6, 0xa1, 0x2e, 0x8a, 0xb2, 0xb0, 0xd5, 0x04, 0x89, - 0x8f, 0x3f, 0x23, 0x43, 0xe0, 0x98, 0x90, 0x7f, 0x7a, 0xfe, 0x43, 0xac, 0x8a, 0x01, - 0x14, 0x42, 0x35, 0x80, 0x97, 0x53, 0x67, 0xba, 0x4b, 0x6d, 0x16, 0x6c, 0x44, 0x28, - 0x48, 0x57, 0xb7, 0xcd, 0x29, 0xa8, 0x38, 0xb4, 0x9c, 0xc3, 0x41, 0xd2, 0x89, 0x51, - 0xaa, 0x0b, 0x5d, 0x55, 0x6a, 0x20, 0x9e, 0xb6, + 0x00, 0x17, 0xc2, 0xe5, 0xdf, 0x2e, 0xa6, 0xa1, 0x2e, 0x8a, 0xb2, 0xb0, 0xd5, 0x04, + 0x89, 0x8f, 0x3f, 0x23, 0x43, 0xe0, 0x98, 0x90, 0x7f, 0x7a, 0xfe, 0x43, 0xac, 0x8a, + 0x01, 0x14, 0x42, 0x35, 0x80, 0x97, 0x53, 0x67, 0xba, 0x4b, 0x6d, 0x16, 0x6c, 0x44, + 0x28, 0x48, 0x57, 0xb7, 0xcd, 0x29, 0xa8, 0x38, 0xb4, 0x9c, 0xc3, 0x41, 0xd2, 0x89, + 0x51, 0xaa, 0x0b, 0x5d, 0x55, 0x6a, 0x20, 0x9e, 0xb6, ], }, TestVector { @@ -135,9 +135,9 @@ pub(crate) const TEST_VECTORS: &[TestVector] = &[ 0x32, 0x0d, 0xad, 0xd6, ], ik: [ - 0x0b, 0xb4, 0x91, 0x3d, 0xba, 0xf1, 0x4e, 0xf6, 0xd0, 0xad, 0xeb, 0x8b, 0x70, 0x27, - 0xbf, 0x0b, 0x9a, 0x8f, 0x59, 0x0d, 0x3e, 0x2d, 0x95, 0xa1, 0x2d, 0xba, 0xaf, 0x0b, - 0x95, 0x33, 0xdc, 0xa4, + 0x00, 0x0b, 0xb4, 0x91, 0x3d, 0xba, 0xf1, 0x4e, 0xf6, 0xd0, 0xad, 0xeb, 0x8b, 0x70, + 0x27, 0xbf, 0x0b, 0x9a, 0x8f, 0x59, 0x0d, 0x3e, 0x2d, 0x95, 0xa1, 0x2d, 0xba, 0xaf, + 0x0b, 0x95, 0x33, 0xdc, 0xa4, ], msg: [ 0x4f, 0x54, 0x31, 0xe6, 0x1d, 0xdf, 0x65, 0x8d, 0x24, 0xae, 0x67, 0xc2, 0x2c, 0x8d, @@ -145,11 +145,11 @@ pub(crate) const TEST_VECTORS: &[TestVector] = &[ 0x47, 0xf1, 0xe1, 0x91, ], sig: [ - 0x42, 0x1f, 0x5b, 0x07, 0x57, 0x2e, 0x6b, 0x05, 0xe8, 0x0b, 0xa5, 0x85, 0xff, 0x63, - 0x21, 0x42, 0x26, 0x75, 0xcd, 0x19, 0xea, 0x59, 0x15, 0xd6, 0x32, 0xeb, 0x47, 0x64, - 0x6c, 0xe2, 0x20, 0x27, 0x6b, 0xb7, 0x82, 0x42, 0xcc, 0x75, 0x48, 0xd9, 0xa0, 0x57, - 0x2b, 0x89, 0x69, 0x2e, 0x5b, 0x95, 0xdb, 0x14, 0x14, 0xe4, 0xeb, 0xd2, 0x20, 0xcc, - 0xf8, 0x3a, 0xf2, 0x98, 0x2f, 0xdd, 0x3a, 0xec, + 0x00, 0x42, 0x1f, 0x5b, 0x07, 0x57, 0x2e, 0x6b, 0x05, 0xe8, 0x0b, 0xa5, 0x85, 0xff, + 0x63, 0x21, 0x42, 0x26, 0x75, 0xcd, 0x19, 0xea, 0x59, 0x15, 0xd6, 0x32, 0xeb, 0x47, + 0x64, 0x6c, 0xe2, 0x20, 0x27, 0x6b, 0xb7, 0x82, 0x42, 0xcc, 0x75, 0x48, 0xd9, 0xa0, + 0x57, 0x2b, 0x89, 0x69, 0x2e, 0x5b, 0x95, 0xdb, 0x14, 0x14, 0xe4, 0xeb, 0xd2, 0x20, + 0xcc, 0xf8, 0x3a, 0xf2, 0x98, 0x2f, 0xdd, 0x3a, 0xec, ], }, TestVector { @@ -159,9 +159,9 @@ pub(crate) const TEST_VECTORS: &[TestVector] = &[ 0xe6, 0x9c, 0xe8, 0xfc, ], ik: [ - 0x61, 0xbb, 0x33, 0x91, 0x59, 0xdf, 0x98, 0x20, 0xef, 0xae, 0xb6, 0x1d, 0x9a, 0x10, - 0xcd, 0xc1, 0x3b, 0x4c, 0x99, 0xfd, 0xc8, 0x6d, 0x94, 0x85, 0x11, 0x5d, 0xfd, 0x83, - 0x62, 0x36, 0xac, 0xf8, + 0x00, 0x61, 0xbb, 0x33, 0x91, 0x59, 0xdf, 0x98, 0x20, 0xef, 0xae, 0xb6, 0x1d, 0x9a, + 0x10, 0xcd, 0xc1, 0x3b, 0x4c, 0x99, 0xfd, 0xc8, 0x6d, 0x94, 0x85, 0x11, 0x5d, 0xfd, + 0x83, 0x62, 0x36, 0xac, 0xf8, ], msg: [ 0x1b, 0xe4, 0xaa, 0xc0, 0x0f, 0xf2, 0x71, 0x1e, 0xbd, 0x93, 0x1d, 0xe5, 0x18, 0x85, @@ -169,11 +169,11 @@ pub(crate) const TEST_VECTORS: &[TestVector] = &[ 0xf7, 0x39, 0x3c, 0x94, ], sig: [ - 0x5a, 0x11, 0x48, 0xa8, 0x92, 0x8f, 0xbf, 0x43, 0xbb, 0x33, 0xa5, 0x70, 0xf0, 0xdf, - 0xa3, 0x53, 0x32, 0xb7, 0x01, 0x80, 0x21, 0xa0, 0xcb, 0x75, 0xe9, 0x55, 0x4e, 0x86, - 0xec, 0xb2, 0x1d, 0xa3, 0x2e, 0xb5, 0xa2, 0xd8, 0xc5, 0x9e, 0xa3, 0x90, 0x43, 0xb9, - 0x74, 0x78, 0x75, 0x0c, 0x6b, 0xf8, 0x66, 0xeb, 0x3b, 0x01, 0x5e, 0xbb, 0x31, 0x68, - 0xf7, 0x53, 0x76, 0x6a, 0xd1, 0x71, 0xd2, 0x1e, + 0x00, 0x5a, 0x11, 0x48, 0xa8, 0x92, 0x8f, 0xbf, 0x43, 0xbb, 0x33, 0xa5, 0x70, 0xf0, + 0xdf, 0xa3, 0x53, 0x32, 0xb7, 0x01, 0x80, 0x21, 0xa0, 0xcb, 0x75, 0xe9, 0x55, 0x4e, + 0x86, 0xec, 0xb2, 0x1d, 0xa3, 0x2e, 0xb5, 0xa2, 0xd8, 0xc5, 0x9e, 0xa3, 0x90, 0x43, + 0xb9, 0x74, 0x78, 0x75, 0x0c, 0x6b, 0xf8, 0x66, 0xeb, 0x3b, 0x01, 0x5e, 0xbb, 0x31, + 0x68, 0xf7, 0x53, 0x76, 0x6a, 0xd1, 0x71, 0xd2, 0x1e, ], }, TestVector { @@ -183,9 +183,9 @@ pub(crate) const TEST_VECTORS: &[TestVector] = &[ 0xf4, 0x68, 0xa0, 0x08, ], ik: [ - 0x19, 0x58, 0x53, 0x8b, 0x12, 0x17, 0xa0, 0x3d, 0x89, 0xcd, 0x83, 0xb8, 0x3d, 0x0b, - 0xdd, 0x40, 0xa6, 0x9a, 0xbe, 0x3a, 0xc2, 0x5d, 0x00, 0xc6, 0xd2, 0x69, 0x97, 0xf9, - 0xf2, 0x57, 0x4d, 0x4f, + 0x00, 0x19, 0x58, 0x53, 0x8b, 0x12, 0x17, 0xa0, 0x3d, 0x89, 0xcd, 0x83, 0xb8, 0x3d, + 0x0b, 0xdd, 0x40, 0xa6, 0x9a, 0xbe, 0x3a, 0xc2, 0x5d, 0x00, 0xc6, 0xd2, 0x69, 0x97, + 0xf9, 0xf2, 0x57, 0x4d, 0x4f, ], msg: [ 0xe7, 0x23, 0x89, 0xfc, 0x03, 0x88, 0x0d, 0x78, 0x0c, 0xb0, 0x7f, 0xcf, 0xaa, 0xbe, @@ -193,11 +193,11 @@ pub(crate) const TEST_VECTORS: &[TestVector] = &[ 0x03, 0x59, 0x65, 0x55, ], sig: [ - 0x16, 0x90, 0xf5, 0x43, 0xee, 0x67, 0xbb, 0x1c, 0xe0, 0xe4, 0x25, 0x4e, 0xa5, 0xdf, - 0xd0, 0x42, 0xfe, 0x86, 0x3a, 0xb4, 0x6c, 0xd9, 0xa8, 0x90, 0x55, 0x19, 0xff, 0xb1, - 0xb8, 0x40, 0x6b, 0xec, 0xbd, 0x90, 0xda, 0x66, 0xe5, 0xb5, 0x44, 0xbc, 0xd4, 0x3b, - 0xdb, 0x29, 0xbc, 0x5d, 0x2c, 0x02, 0x4d, 0xd2, 0x85, 0xab, 0xcd, 0x77, 0xe4, 0xac, - 0x1f, 0x9d, 0x60, 0x35, 0x22, 0xe4, 0xf1, 0x5b, + 0x00, 0x16, 0x90, 0xf5, 0x43, 0xee, 0x67, 0xbb, 0x1c, 0xe0, 0xe4, 0x25, 0x4e, 0xa5, + 0xdf, 0xd0, 0x42, 0xfe, 0x86, 0x3a, 0xb4, 0x6c, 0xd9, 0xa8, 0x90, 0x55, 0x19, 0xff, + 0xb1, 0xb8, 0x40, 0x6b, 0xec, 0xbd, 0x90, 0xda, 0x66, 0xe5, 0xb5, 0x44, 0xbc, 0xd4, + 0x3b, 0xdb, 0x29, 0xbc, 0x5d, 0x2c, 0x02, 0x4d, 0xd2, 0x85, 0xab, 0xcd, 0x77, 0xe4, + 0xac, 0x1f, 0x9d, 0x60, 0x35, 0x22, 0xe4, 0xf1, 0x5b, ], }, TestVector { @@ -207,9 +207,9 @@ pub(crate) const TEST_VECTORS: &[TestVector] = &[ 0x99, 0x58, 0x9c, 0x8b, ], ik: [ - 0x7d, 0xd6, 0xd7, 0x61, 0xe1, 0x02, 0x01, 0x37, 0xfa, 0x01, 0xb4, 0xdd, 0xd3, 0xb0, - 0xf3, 0x48, 0x04, 0xcc, 0x10, 0xcc, 0x4e, 0x9f, 0x6e, 0x9d, 0xf5, 0xb6, 0x04, 0x69, - 0xf5, 0x79, 0x36, 0x67, + 0x00, 0x7d, 0xd6, 0xd7, 0x61, 0xe1, 0x02, 0x01, 0x37, 0xfa, 0x01, 0xb4, 0xdd, 0xd3, + 0xb0, 0xf3, 0x48, 0x04, 0xcc, 0x10, 0xcc, 0x4e, 0x9f, 0x6e, 0x9d, 0xf5, 0xb6, 0x04, + 0x69, 0xf5, 0x79, 0x36, 0x67, ], msg: [ 0xb8, 0x38, 0xe8, 0xaa, 0xf7, 0x45, 0x53, 0x3e, 0xd9, 0xe8, 0xae, 0x3a, 0x1c, 0xd0, @@ -217,11 +217,11 @@ pub(crate) const TEST_VECTORS: &[TestVector] = &[ 0xed, 0x42, 0x43, 0x5e, ], sig: [ - 0x59, 0x34, 0x5d, 0x6b, 0x89, 0x4e, 0xd6, 0xd0, 0x3a, 0x56, 0x73, 0xa0, 0x14, 0x63, - 0x07, 0x51, 0x04, 0x3d, 0x11, 0xfa, 0x63, 0x18, 0x7c, 0x92, 0x9c, 0xae, 0x3f, 0xa1, - 0xb0, 0x29, 0x22, 0xf2, 0x7d, 0xc0, 0x16, 0x40, 0x33, 0x95, 0x2c, 0x84, 0x16, 0xe6, - 0xd0, 0x43, 0x81, 0x77, 0xb3, 0xbc, 0xe8, 0x78, 0xfd, 0xec, 0x75, 0x0a, 0x16, 0x64, - 0xd4, 0x89, 0xdf, 0x0a, 0x4e, 0xae, 0xb1, 0x35, + 0x00, 0x59, 0x34, 0x5d, 0x6b, 0x89, 0x4e, 0xd6, 0xd0, 0x3a, 0x56, 0x73, 0xa0, 0x14, + 0x63, 0x07, 0x51, 0x04, 0x3d, 0x11, 0xfa, 0x63, 0x18, 0x7c, 0x92, 0x9c, 0xae, 0x3f, + 0xa1, 0xb0, 0x29, 0x22, 0xf2, 0x7d, 0xc0, 0x16, 0x40, 0x33, 0x95, 0x2c, 0x84, 0x16, + 0xe6, 0xd0, 0x43, 0x81, 0x77, 0xb3, 0xbc, 0xe8, 0x78, 0xfd, 0xec, 0x75, 0x0a, 0x16, + 0x64, 0xd4, 0x89, 0xdf, 0x0a, 0x4e, 0xae, 0xb1, 0x35, ], }, TestVector { @@ -231,9 +231,9 @@ pub(crate) const TEST_VECTORS: &[TestVector] = &[ 0xf2, 0x65, 0x72, 0x50, ], ik: [ - 0xb5, 0x9c, 0x5f, 0x32, 0x34, 0xd6, 0xca, 0x36, 0xcc, 0x48, 0x3d, 0x67, 0xa8, 0x4f, - 0x37, 0xd6, 0xb2, 0x4b, 0x24, 0x45, 0x48, 0x25, 0xd2, 0xb7, 0xbf, 0xdc, 0x80, 0x2b, - 0x2e, 0x32, 0x8c, 0x43, + 0x00, 0xb5, 0x9c, 0x5f, 0x32, 0x34, 0xd6, 0xca, 0x36, 0xcc, 0x48, 0x3d, 0x67, 0xa8, + 0x4f, 0x37, 0xd6, 0xb2, 0x4b, 0x24, 0x45, 0x48, 0x25, 0xd2, 0xb7, 0xbf, 0xdc, 0x80, + 0x2b, 0x2e, 0x32, 0x8c, 0x43, ], msg: [ 0x4b, 0x19, 0x22, 0x32, 0xec, 0xb9, 0xf0, 0xc0, 0x24, 0x11, 0xe5, 0x25, 0x96, 0xbc, @@ -241,11 +241,11 @@ pub(crate) const TEST_VECTORS: &[TestVector] = &[ 0x1a, 0x02, 0xaf, 0x11, ], sig: [ - 0xa4, 0x58, 0x79, 0x33, 0x26, 0x98, 0x37, 0x74, 0x09, 0x6d, 0x36, 0x59, 0xeb, 0x9a, - 0x21, 0xd1, 0x2c, 0x8e, 0xb8, 0x77, 0x56, 0x6b, 0x66, 0xbf, 0x60, 0x33, 0xdb, 0x8f, - 0xde, 0x20, 0xc4, 0x66, 0xa2, 0xe9, 0x54, 0x30, 0xa0, 0x1e, 0xb9, 0xad, 0x28, 0xe0, - 0x76, 0x5b, 0xed, 0x21, 0xdc, 0xd3, 0x03, 0x86, 0xfc, 0xe7, 0xaa, 0xba, 0xde, 0xa6, - 0xda, 0x72, 0x8c, 0x16, 0xbb, 0x80, 0xf1, 0xc2, + 0x00, 0xa4, 0x58, 0x79, 0x33, 0x26, 0x98, 0x37, 0x74, 0x09, 0x6d, 0x36, 0x59, 0xeb, + 0x9a, 0x21, 0xd1, 0x2c, 0x8e, 0xb8, 0x77, 0x56, 0x6b, 0x66, 0xbf, 0x60, 0x33, 0xdb, + 0x8f, 0xde, 0x20, 0xc4, 0x66, 0xa2, 0xe9, 0x54, 0x30, 0xa0, 0x1e, 0xb9, 0xad, 0x28, + 0xe0, 0x76, 0x5b, 0xed, 0x21, 0xdc, 0xd3, 0x03, 0x86, 0xfc, 0xe7, 0xaa, 0xba, 0xde, + 0xa6, 0xda, 0x72, 0x8c, 0x16, 0xbb, 0x80, 0xf1, 0xc2, ], }, TestVector { @@ -255,9 +255,9 @@ pub(crate) const TEST_VECTORS: &[TestVector] = &[ 0xcc, 0x40, 0xa9, 0x8d, ], ik: [ - 0x45, 0x61, 0x9f, 0x20, 0x6c, 0x3b, 0xfc, 0x84, 0xfd, 0x42, 0x4f, 0xfb, 0x5c, 0x81, - 0x6f, 0x65, 0x4b, 0x27, 0xaa, 0x7f, 0x7b, 0x4b, 0xd6, 0x7e, 0xc5, 0xf9, 0xac, 0x6d, - 0x0f, 0x38, 0xdb, 0xb1, + 0x00, 0x45, 0x61, 0x9f, 0x20, 0x6c, 0x3b, 0xfc, 0x84, 0xfd, 0x42, 0x4f, 0xfb, 0x5c, + 0x81, 0x6f, 0x65, 0x4b, 0x27, 0xaa, 0x7f, 0x7b, 0x4b, 0xd6, 0x7e, 0xc5, 0xf9, 0xac, + 0x6d, 0x0f, 0x38, 0xdb, 0xb1, ], msg: [ 0x5f, 0x29, 0x35, 0x39, 0x5e, 0xe4, 0x76, 0x2d, 0xd2, 0x1a, 0xfd, 0xbb, 0x5d, 0x47, @@ -265,11 +265,11 @@ pub(crate) const TEST_VECTORS: &[TestVector] = &[ 0xe2, 0xdb, 0x58, 0x71, ], sig: [ - 0xe6, 0x92, 0x4d, 0x53, 0xec, 0x97, 0x80, 0x79, 0xd6, 0x6a, 0x28, 0x4c, 0x00, 0xa8, - 0x68, 0xf9, 0xeb, 0x75, 0x1a, 0xe3, 0xb1, 0x69, 0x0d, 0x15, 0xee, 0x1b, 0x39, 0x68, - 0x0b, 0x83, 0xc4, 0x38, 0xe4, 0x5f, 0x02, 0xa2, 0x3c, 0x65, 0x6e, 0x4e, 0x53, 0xd3, - 0xc7, 0x3e, 0xfa, 0x0d, 0xc5, 0xf7, 0xad, 0x63, 0x28, 0x21, 0x7f, 0xd5, 0x9b, 0x23, - 0xaa, 0xe4, 0xf9, 0x0c, 0x68, 0xbe, 0x76, 0xbc, + 0x00, 0xe6, 0x92, 0x4d, 0x53, 0xec, 0x97, 0x80, 0x79, 0xd6, 0x6a, 0x28, 0x4c, 0x00, + 0xa8, 0x68, 0xf9, 0xeb, 0x75, 0x1a, 0xe3, 0xb1, 0x69, 0x0d, 0x15, 0xee, 0x1b, 0x39, + 0x68, 0x0b, 0x83, 0xc4, 0x38, 0xe4, 0x5f, 0x02, 0xa2, 0x3c, 0x65, 0x6e, 0x4e, 0x53, + 0xd3, 0xc7, 0x3e, 0xfa, 0x0d, 0xc5, 0xf7, 0xad, 0x63, 0x28, 0x21, 0x7f, 0xd5, 0x9b, + 0x23, 0xaa, 0xe4, 0xf9, 0x0c, 0x68, 0xbe, 0x76, 0xbc, ], }, ]; diff --git a/src/test_vectors/keys.rs b/src/test_vectors/keys.rs index e078f819b..9cc5bad82 100644 --- a/src/test_vectors/keys.rs +++ b/src/test_vectors/keys.rs @@ -5,7 +5,7 @@ pub(crate) struct TestVector { pub(crate) ask: [u8; 32], pub(crate) ak: [u8; 32], pub(crate) isk: [u8; 32], - pub(crate) ik: [u8; 32], + pub(crate) ik: [u8; 33], pub(crate) nk: [u8; 32], pub(crate) rivk: [u8; 32], pub(crate) ivk: [u8; 32], @@ -48,9 +48,9 @@ pub(crate) const TEST_VECTORS: &[TestVector] = &[ 0x99, 0x0e, 0xd8, 0x3d, ], ik: [ - 0xd1, 0xa2, 0xfa, 0xb4, 0x17, 0x0c, 0x45, 0xc5, 0xf9, 0x79, 0xc8, 0xe7, 0x46, 0x3b, - 0x8e, 0x20, 0xf2, 0x34, 0xde, 0x35, 0xeb, 0x58, 0xa8, 0x38, 0xdf, 0x9a, 0x1f, 0xe9, - 0xb1, 0xa5, 0xaa, 0x45, + 0x00, 0xd1, 0xa2, 0xfa, 0xb4, 0x17, 0x0c, 0x45, 0xc5, 0xf9, 0x79, 0xc8, 0xe7, 0x46, + 0x3b, 0x8e, 0x20, 0xf2, 0x34, 0xde, 0x35, 0xeb, 0x58, 0xa8, 0x38, 0xdf, 0x9a, 0x1f, + 0xe9, 0xb1, 0xa5, 0xaa, 0x45, ], nk: [ 0x9f, 0x2f, 0x82, 0x67, 0x38, 0x94, 0x5a, 0xd0, 0x1f, 0x47, 0xf7, 0x0d, 0xb0, 0xc3, @@ -154,9 +154,9 @@ pub(crate) const TEST_VECTORS: &[TestVector] = &[ 0x89, 0x26, 0xc1, 0x03, ], ik: [ - 0x39, 0x62, 0x5b, 0x51, 0xaa, 0x0a, 0x3d, 0xde, 0x54, 0x6e, 0xde, 0x39, 0xa1, 0x23, - 0x2f, 0xa9, 0xba, 0xe8, 0x71, 0xab, 0x4f, 0x18, 0xe9, 0x0e, 0x5a, 0xe8, 0x03, 0x8c, - 0xce, 0xef, 0x66, 0x37, + 0x00, 0x39, 0x62, 0x5b, 0x51, 0xaa, 0x0a, 0x3d, 0xde, 0x54, 0x6e, 0xde, 0x39, 0xa1, + 0x23, 0x2f, 0xa9, 0xba, 0xe8, 0x71, 0xab, 0x4f, 0x18, 0xe9, 0x0e, 0x5a, 0xe8, 0x03, + 0x8c, 0xce, 0xef, 0x66, 0x37, ], nk: [ 0x26, 0x84, 0x71, 0xe4, 0x66, 0xfe, 0x31, 0x2d, 0xd2, 0x07, 0x5d, 0x1a, 0x1a, 0x07, @@ -260,9 +260,9 @@ pub(crate) const TEST_VECTORS: &[TestVector] = &[ 0xa9, 0x59, 0xcc, 0x97, ], ik: [ - 0x78, 0xd1, 0xdc, 0xef, 0xee, 0x06, 0xc5, 0x66, 0x7f, 0x19, 0x76, 0xa5, 0x66, 0x73, - 0x13, 0x0b, 0x9e, 0x72, 0x05, 0xf3, 0xa5, 0x0a, 0xd1, 0x96, 0x00, 0x89, 0x6c, 0xe5, - 0xc2, 0x64, 0xfa, 0xf6, + 0x00, 0x78, 0xd1, 0xdc, 0xef, 0xee, 0x06, 0xc5, 0x66, 0x7f, 0x19, 0x76, 0xa5, 0x66, + 0x73, 0x13, 0x0b, 0x9e, 0x72, 0x05, 0xf3, 0xa5, 0x0a, 0xd1, 0x96, 0x00, 0x89, 0x6c, + 0xe5, 0xc2, 0x64, 0xfa, 0xf6, ], nk: [ 0x9d, 0xca, 0xb0, 0x5e, 0x6c, 0x24, 0x15, 0xad, 0x65, 0xb6, 0x4e, 0x6a, 0x9a, 0xec, @@ -366,9 +366,9 @@ pub(crate) const TEST_VECTORS: &[TestVector] = &[ 0x71, 0x62, 0x69, 0xb9, ], ik: [ - 0x39, 0xc4, 0x51, 0xf4, 0xd8, 0xdd, 0xcf, 0x69, 0x05, 0xed, 0xd8, 0x82, 0x5a, 0xd9, - 0x81, 0xb9, 0xe7, 0x3c, 0xa6, 0x83, 0x1c, 0xa2, 0xb3, 0xd7, 0xe8, 0xce, 0xf3, 0xd0, - 0xba, 0xaa, 0x31, 0x1b, + 0x00, 0x39, 0xc4, 0x51, 0xf4, 0xd8, 0xdd, 0xcf, 0x69, 0x05, 0xed, 0xd8, 0x82, 0x5a, + 0xd9, 0x81, 0xb9, 0xe7, 0x3c, 0xa6, 0x83, 0x1c, 0xa2, 0xb3, 0xd7, 0xe8, 0xce, 0xf3, + 0xd0, 0xba, 0xaa, 0x31, 0x1b, ], nk: [ 0x8d, 0xa4, 0xba, 0x62, 0x70, 0xae, 0x6d, 0x89, 0xa8, 0x6a, 0x06, 0xbc, 0x84, 0xbb, @@ -472,9 +472,9 @@ pub(crate) const TEST_VECTORS: &[TestVector] = &[ 0x2e, 0x19, 0xe5, 0x94, ], ik: [ - 0x2b, 0x5d, 0xe5, 0x60, 0x92, 0xfe, 0xa3, 0x1a, 0x8e, 0xa9, 0xf8, 0x70, 0x84, 0x7d, - 0xc1, 0xfa, 0x87, 0xfd, 0x3c, 0x25, 0xcf, 0x70, 0x9a, 0x0e, 0xff, 0xd6, 0x99, 0xc2, - 0x96, 0x41, 0x31, 0x6e, + 0x00, 0x2b, 0x5d, 0xe5, 0x60, 0x92, 0xfe, 0xa3, 0x1a, 0x8e, 0xa9, 0xf8, 0x70, 0x84, + 0x7d, 0xc1, 0xfa, 0x87, 0xfd, 0x3c, 0x25, 0xcf, 0x70, 0x9a, 0x0e, 0xff, 0xd6, 0x99, + 0xc2, 0x96, 0x41, 0x31, 0x6e, ], nk: [ 0x4f, 0xb7, 0x68, 0x10, 0x2e, 0x99, 0xbe, 0xfe, 0x6e, 0x76, 0xed, 0x4e, 0xea, 0x65, @@ -578,9 +578,9 @@ pub(crate) const TEST_VECTORS: &[TestVector] = &[ 0xc1, 0xec, 0x14, 0x4b, ], ik: [ - 0xe2, 0xb7, 0xd3, 0x28, 0x92, 0x52, 0xf8, 0x69, 0x17, 0xd4, 0xcb, 0x43, 0x04, 0xbe, - 0x9a, 0x06, 0xd6, 0x25, 0xdb, 0x6f, 0xb2, 0xcb, 0xea, 0xf8, 0x84, 0xc2, 0x80, 0x66, - 0x94, 0x16, 0xad, 0x30, + 0x00, 0xe2, 0xb7, 0xd3, 0x28, 0x92, 0x52, 0xf8, 0x69, 0x17, 0xd4, 0xcb, 0x43, 0x04, + 0xbe, 0x9a, 0x06, 0xd6, 0x25, 0xdb, 0x6f, 0xb2, 0xcb, 0xea, 0xf8, 0x84, 0xc2, 0x80, + 0x66, 0x94, 0x16, 0xad, 0x30, ], nk: [ 0x54, 0x81, 0x3a, 0x55, 0x4c, 0xd0, 0x88, 0xfd, 0xad, 0x77, 0x91, 0x00, 0xa5, 0xa4, @@ -684,9 +684,9 @@ pub(crate) const TEST_VECTORS: &[TestVector] = &[ 0x07, 0x39, 0xf0, 0x53, ], ik: [ - 0x03, 0xd8, 0x30, 0x92, 0xd7, 0x09, 0xcb, 0x92, 0x8f, 0xf1, 0x50, 0xf0, 0x8e, 0xa2, - 0x68, 0xe8, 0x45, 0x41, 0x80, 0xcd, 0xc4, 0x9f, 0x07, 0xf5, 0xa3, 0xd9, 0xb2, 0x03, - 0x90, 0x68, 0xc9, 0x09, + 0x00, 0x03, 0xd8, 0x30, 0x92, 0xd7, 0x09, 0xcb, 0x92, 0x8f, 0xf1, 0x50, 0xf0, 0x8e, + 0xa2, 0x68, 0xe8, 0x45, 0x41, 0x80, 0xcd, 0xc4, 0x9f, 0x07, 0xf5, 0xa3, 0xd9, 0xb2, + 0x03, 0x90, 0x68, 0xc9, 0x09, ], nk: [ 0x0d, 0x47, 0x60, 0xf0, 0xe9, 0x3d, 0x2c, 0x4b, 0x67, 0x6e, 0x88, 0xfa, 0x40, 0xfa, @@ -790,9 +790,9 @@ pub(crate) const TEST_VECTORS: &[TestVector] = &[ 0x02, 0x25, 0xa9, 0xe2, ], ik: [ - 0x78, 0xfe, 0x62, 0x0f, 0xc5, 0x91, 0x3f, 0xc1, 0x8a, 0xa2, 0x09, 0x36, 0x40, 0x9d, - 0x38, 0x8f, 0x0f, 0x10, 0x88, 0x14, 0xa7, 0x5e, 0x93, 0x1b, 0xea, 0xcb, 0x61, 0x83, - 0xa9, 0xbe, 0x18, 0xc4, + 0x00, 0x78, 0xfe, 0x62, 0x0f, 0xc5, 0x91, 0x3f, 0xc1, 0x8a, 0xa2, 0x09, 0x36, 0x40, + 0x9d, 0x38, 0x8f, 0x0f, 0x10, 0x88, 0x14, 0xa7, 0x5e, 0x93, 0x1b, 0xea, 0xcb, 0x61, + 0x83, 0xa9, 0xbe, 0x18, 0xc4, ], nk: [ 0x88, 0xc5, 0xc9, 0x2d, 0x1c, 0xd0, 0xe5, 0x01, 0xc9, 0x1d, 0x80, 0x1c, 0x50, 0xdf, @@ -896,9 +896,9 @@ pub(crate) const TEST_VECTORS: &[TestVector] = &[ 0x68, 0x79, 0xbb, 0x66, ], ik: [ - 0x0c, 0x40, 0xa2, 0x9b, 0xdb, 0xe3, 0xe4, 0x5d, 0x2c, 0xb7, 0xc1, 0x41, 0xed, 0xe0, - 0xce, 0x2c, 0xe9, 0x2c, 0xa6, 0xbf, 0x9f, 0x6b, 0xc0, 0x42, 0xb0, 0xe7, 0x25, 0x24, - 0xf4, 0x19, 0x5c, 0xa6, + 0x00, 0x0c, 0x40, 0xa2, 0x9b, 0xdb, 0xe3, 0xe4, 0x5d, 0x2c, 0xb7, 0xc1, 0x41, 0xed, + 0xe0, 0xce, 0x2c, 0xe9, 0x2c, 0xa6, 0xbf, 0x9f, 0x6b, 0xc0, 0x42, 0xb0, 0xe7, 0x25, + 0x24, 0xf4, 0x19, 0x5c, 0xa6, ], nk: [ 0x2c, 0x5c, 0xc2, 0x37, 0x14, 0xa6, 0x22, 0xa0, 0xb9, 0xe2, 0x0a, 0x1f, 0x0f, 0x23, @@ -1002,9 +1002,9 @@ pub(crate) const TEST_VECTORS: &[TestVector] = &[ 0x6c, 0x4a, 0x2f, 0xbe, ], ik: [ - 0x6c, 0xc4, 0x46, 0x5c, 0x0a, 0x64, 0xa5, 0xec, 0x41, 0x96, 0x8a, 0x80, 0x9f, 0x71, - 0x3d, 0xf6, 0xf3, 0x45, 0x1c, 0x5e, 0xec, 0xff, 0xf5, 0x31, 0x7a, 0x21, 0x0c, 0xc7, - 0xc8, 0x50, 0xbd, 0x51, + 0x00, 0x6c, 0xc4, 0x46, 0x5c, 0x0a, 0x64, 0xa5, 0xec, 0x41, 0x96, 0x8a, 0x80, 0x9f, + 0x71, 0x3d, 0xf6, 0xf3, 0x45, 0x1c, 0x5e, 0xec, 0xff, 0xf5, 0x31, 0x7a, 0x21, 0x0c, + 0xc7, 0xc8, 0x50, 0xbd, 0x51, ], nk: [ 0x5c, 0x39, 0x80, 0xe1, 0x5d, 0xba, 0xd3, 0x67, 0xf4, 0xa1, 0xd3, 0x89, 0x15, 0x78, From 7705f8c6b8ae7260b7e05732eaa72e1b61fa33b5 Mon Sep 17 00:00:00 2001 From: Vivek Arte Date: Mon, 14 Jul 2025 19:03:52 +0530 Subject: [PATCH 5/9] WIP to improve the signature scheme specification --- src/keys.rs | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/src/keys.rs b/src/keys.rs index c79af07b3..cade369bf 100644 --- a/src/keys.rs +++ b/src/keys.rs @@ -238,7 +238,17 @@ fn check_structural_validity( } } -/// An enum of the supported scheme used for issuance authorization signatures. +/// A struct containing details of an issuance authorization signature scheme +/// that every signature scheme must expose. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub struct IssuanceAuthSigDetails { + key_algorithm_byte: u8, + key_length: usize, + sig_algorithm_byte: u8, + sig_length: usize, +} + +/// An enum of supported schemes for issuance authorization signatures. #[derive(Debug, Clone, PartialEq, Eq)] pub enum IssuanceAuthSigScheme { /// The signature scheme specified in [ZIP 227][issuanceauthsig]. @@ -247,6 +257,25 @@ pub enum IssuanceAuthSigScheme { Zip227, } +impl IssuanceAuthSigScheme { + /// These are the constants of the [ZIP 227][issuanceauthsig] Schnorr signature scheme based on BIP 340. + /// + /// [issuanceauthsig]: https://zips.z.cash/zip-0227#orchard-zsa-issuance-authorization-signature-scheme + pub const ZIP227_DETAILS: IssuanceAuthSigDetails = IssuanceAuthSigDetails { + key_algorithm_byte: 0x00, + key_length: 33, + sig_algorithm_byte: 0x00, + sig_length: 65, + }; + + /// Returns the details of the specific issuance authorization signature scheme. + pub const fn scheme_details(self) -> IssuanceAuthSigDetails { + match self { + IssuanceAuthSigScheme::Zip227 => Self::ZIP227_DETAILS, + } + } +} + /// An issuance key, from which all key material is derived. /// /// $\mathsf{isk}$ as defined in [ZIP 227][issuancekeycomponents]. From 879b9a1c18e07201d921b3a347581991968a894c Mon Sep 17 00:00:00 2001 From: Vivek Arte Date: Wed, 16 Jul 2025 13:03:07 +0530 Subject: [PATCH 6/9] changes to to_bytes and from_bytes --- src/issuance.rs | 9 +++--- src/keys.rs | 77 ++++++++++++++++++++++++++++++------------------- 2 files changed, 51 insertions(+), 35 deletions(-) diff --git a/src/issuance.rs b/src/issuance.rs index de6aab31f..35abf56b3 100644 --- a/src/issuance.rs +++ b/src/issuance.rs @@ -106,7 +106,7 @@ impl IssuanceAuthorizationSignature { pub fn to_bytes(&self) -> [u8; 65] { let mut bytes = [0u8; 65]; match &self.scheme { - IssuanceAuthSigScheme::Zip227 => bytes[0] = 0x00, + IssuanceAuthSigScheme::ZsaSchnorrSigV1 => bytes[0] = 0x00, } bytes[1..].copy_from_slice(&self.signature.to_bytes()); bytes @@ -120,7 +120,7 @@ impl IssuanceAuthorizationSignature { let signature = schnorr::Signature::try_from(&bytes[1..]).map_err(|_| IssueBundleInvalidSignature)?; Ok(IssuanceAuthorizationSignature { - scheme: IssuanceAuthSigScheme::Zip227, + scheme: IssuanceAuthSigScheme::ZsaSchnorrSigV1, signature, }) } @@ -1905,8 +1905,7 @@ pub mod testing { AwaitingNullifier, IssuanceAuthorizationSignature, IssueAction, IssueBundle, Prepared, Signed, }, - keys::testing::arb_issuance_validating_key, - keys::IssuanceAuthSigScheme::Zip227, + keys::{testing::arb_issuance_validating_key, IssuanceAuthSigScheme}, note::asset_base::testing::zsa_asset_base, note::testing::arb_zsa_note, }; @@ -1922,7 +1921,7 @@ pub mod testing { sig_bytes in vec(prop::num::u8::ANY, 64) ) -> IssuanceAuthorizationSignature { IssuanceAuthorizationSignature::new( - Zip227, + IssuanceAuthSigScheme::ZsaSchnorrSigV1, schnorr::Signature::try_from(sig_bytes.as_slice()).unwrap() ) } diff --git a/src/keys.rs b/src/keys.rs index cade369bf..2f10f2476 100644 --- a/src/keys.rs +++ b/src/keys.rs @@ -238,42 +238,66 @@ fn check_structural_validity( } } -/// A struct containing details of an issuance authorization signature scheme -/// that every signature scheme must expose. +/// Complete, immutable description of a supported scheme. #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub struct IssuanceAuthSigDetails { - key_algorithm_byte: u8, - key_length: usize, - sig_algorithm_byte: u8, - sig_length: usize, + /// The byte that identifies the key algorithm. + pub key_algorithm_byte: u8, + /// The length of the issuance validating key for the scheme. + pub key_length: usize, + /// The length of the issuance authorization signature for the scheme. + pub sig_length: usize, } -/// An enum of supported schemes for issuance authorization signatures. -#[derive(Debug, Clone, PartialEq, Eq)] +/// Enumeration of schemes. +/// +/// `#[repr(u8)]` makes the discriminant *equal* to `key_algorithm_byte`, +/// so the mapping is just a cast. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +#[repr(u8)] pub enum IssuanceAuthSigScheme { - /// The signature scheme specified in [ZIP 227][issuanceauthsig]. - /// - /// [issuanceauthsig]: https://zips.z.cash/zip-0227#orchard-zsa-issuance-authorization-signature-scheme - Zip227, + /// OrchardZSA Schnorr/BIP-340 (ZIP-227), version 1. + ZsaSchnorrSigV1 = 0x00, } impl IssuanceAuthSigScheme { + /* ───── associated constants ───── */ + /// These are the constants of the [ZIP 227][issuanceauthsig] Schnorr signature scheme based on BIP 340. /// /// [issuanceauthsig]: https://zips.z.cash/zip-0227#orchard-zsa-issuance-authorization-signature-scheme - pub const ZIP227_DETAILS: IssuanceAuthSigDetails = IssuanceAuthSigDetails { - key_algorithm_byte: 0x00, + pub const ZSA_SCHNORR_SIG_V1_DETAILS: IssuanceAuthSigDetails = IssuanceAuthSigDetails { + key_algorithm_byte: Self::ZsaSchnorrSigV1 as u8, key_length: 33, - sig_algorithm_byte: 0x00, sig_length: 65, }; /// Returns the details of the specific issuance authorization signature scheme. - pub const fn scheme_details(self) -> IssuanceAuthSigDetails { + pub const fn details(self) -> &'static IssuanceAuthSigDetails { match self { - IssuanceAuthSigScheme::Zip227 => Self::ZIP227_DETAILS, + Self::ZsaSchnorrSigV1 => &Self::ZSA_SCHNORR_SIG_V1_DETAILS, } } + + /// Returns the signature scheme being used based on the value of the key algorithm byte. + pub const fn from_key_algorithm_byte(b: u8) -> Option { + match b { + x if x == Self::ZsaSchnorrSigV1 as u8 => Some(Self::ZsaSchnorrSigV1), + _ => None, + } + } +} +impl TryFrom for IssuanceAuthSigScheme { + type Error = (); + fn try_from(value: u8) -> Result { + IssuanceAuthSigScheme::from_key_algorithm_byte(value).ok_or(()) + } +} + +impl From for u8 { + fn from(s: IssuanceAuthSigScheme) -> Self { + s.details().key_algorithm_byte + } } /// An issuance key, from which all key material is derived. @@ -340,7 +364,7 @@ impl IssuanceAuthorizingKey { .sign_prehash(msg) .map_err(|_| issuance::Error::IssueAuthSigGenerationFailed)?; Ok(IssuanceAuthorizationSignature::new( - IssuanceAuthSigScheme::Zip227, + IssuanceAuthSigScheme::ZsaSchnorrSigV1, signature, )) } @@ -368,7 +392,7 @@ pub struct IssuanceValidatingKey { impl From<&IssuanceAuthorizingKey> for IssuanceValidatingKey { fn from(isk: &IssuanceAuthorizingKey) -> Self { IssuanceValidatingKey { - scheme: IssuanceAuthSigScheme::Zip227, + scheme: IssuanceAuthSigScheme::ZsaSchnorrSigV1, key: *schnorr::SigningKey::from(isk.0).verifying_key(), } } @@ -387,9 +411,7 @@ impl IssuanceValidatingKey { /// and the key in big-endian order as defined in BIP 340. pub fn to_bytes(&self) -> [u8; 33] { let mut bytes = [0u8; 33]; - match self.scheme { - IssuanceAuthSigScheme::Zip227 => bytes[0] = 0x00, - } + bytes[0] = self.scheme as u8; bytes[1..].copy_from_slice(&self.key.to_bytes()); bytes } @@ -399,16 +421,11 @@ impl IssuanceValidatingKey { /// /// Returns `None` if the bytes do not correspond to a valid key. pub fn from_bytes(bytes: &[u8]) -> Option { - if bytes.first() == Some(&0x00) { + IssuanceAuthSigScheme::from_key_algorithm_byte(bytes[0]).and_then(|scheme| { schnorr::VerifyingKey::from_bytes(&bytes[1..]) .ok() - .map(|key| IssuanceValidatingKey { - scheme: IssuanceAuthSigScheme::Zip227, - key, - }) - } else { - None - } + .map(|key| IssuanceValidatingKey { scheme, key }) + }) } /// Verifies a purported `signature` over `msg` made by this verification key. From 9433d1bca6ba2cc4c0b805d2140535202f0a6e92 Mon Sep 17 00:00:00 2001 From: Vivek Arte Date: Wed, 16 Jul 2025 14:36:26 +0530 Subject: [PATCH 7/9] changes to to_bytes and from_bytes in signature --- src/issuance.rs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/issuance.rs b/src/issuance.rs index 35abf56b3..24b17f4c4 100644 --- a/src/issuance.rs +++ b/src/issuance.rs @@ -105,24 +105,18 @@ impl IssuanceAuthorizationSignature { /// Returns the byte encoding of the signature. pub fn to_bytes(&self) -> [u8; 65] { let mut bytes = [0u8; 65]; - match &self.scheme { - IssuanceAuthSigScheme::ZsaSchnorrSigV1 => bytes[0] = 0x00, - } + bytes[0] = self.scheme as u8; bytes[1..].copy_from_slice(&self.signature.to_bytes()); bytes } /// Constructs an `IssuanceAuthorizationSignature` from a byte array. pub fn from_bytes(bytes: &[u8; 65]) -> Result { - if bytes.first() != Some(&0x00) { - return Err(IssueBundleInvalidSignature); - } + let scheme = IssuanceAuthSigScheme::from_key_algorithm_byte(bytes[0]) + .ok_or(IssueBundleInvalidSignature)?; let signature = schnorr::Signature::try_from(&bytes[1..]).map_err(|_| IssueBundleInvalidSignature)?; - Ok(IssuanceAuthorizationSignature { - scheme: IssuanceAuthSigScheme::ZsaSchnorrSigV1, - signature, - }) + Ok(IssuanceAuthorizationSignature { scheme, signature }) } } From e84fdcd65cc3ecd01cbbe9683c3e7674e6f87bd2 Mon Sep 17 00:00:00 2001 From: Vivek Arte Date: Thu, 17 Jul 2025 18:53:34 +0530 Subject: [PATCH 8/9] switching to Vec as the return value of to_bytes for the ik and issueAuthSig, along with an assert on the length --- src/issuance.rs | 8 ++++---- src/keys.rs | 11 +++++------ 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/issuance.rs b/src/issuance.rs index 24b17f4c4..87e091586 100644 --- a/src/issuance.rs +++ b/src/issuance.rs @@ -103,10 +103,10 @@ impl IssuanceAuthorizationSignature { } /// Returns the byte encoding of the signature. - pub fn to_bytes(&self) -> [u8; 65] { - let mut bytes = [0u8; 65]; - bytes[0] = self.scheme as u8; - bytes[1..].copy_from_slice(&self.signature.to_bytes()); + pub fn to_bytes(&self) -> Vec { + let mut bytes = vec![self.scheme as u8]; + bytes.extend(self.signature.to_bytes()); + assert_eq!(bytes.len(), self.scheme.details().sig_length); bytes } diff --git a/src/keys.rs b/src/keys.rs index 2f10f2476..c413c483a 100644 --- a/src/keys.rs +++ b/src/keys.rs @@ -409,10 +409,10 @@ impl Eq for IssuanceValidatingKey {} impl IssuanceValidatingKey { /// Converts this issuance validating key to its serialized form, with a scheme byte prefix, /// and the key in big-endian order as defined in BIP 340. - pub fn to_bytes(&self) -> [u8; 33] { - let mut bytes = [0u8; 33]; - bytes[0] = self.scheme as u8; - bytes[1..].copy_from_slice(&self.key.to_bytes()); + pub fn to_bytes(&self) -> Vec { + let mut bytes = vec![self.scheme as u8]; + bytes.extend(self.key.to_bytes()); + assert_eq!(bytes.len(), self.scheme.details().key_length); bytes } @@ -1359,8 +1359,7 @@ mod tests { let message = tv.msg; let signature = isk.try_sign(&message).unwrap(); - let sig_bytes: [u8; 65] = signature.to_bytes(); - assert_eq!(sig_bytes, tv.sig); + assert_eq!(signature.to_bytes().as_slice(), &tv.sig); assert!(ik.verify(&message, &signature).is_ok()); } From 2e06e4304911568f55574689ace0ad195ffe9610 Mon Sep 17 00:00:00 2001 From: Vivek Arte Date: Sun, 3 Aug 2025 11:50:40 +0530 Subject: [PATCH 9/9] fixing clippy error --- src/issuance.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/issuance.rs b/src/issuance.rs index 87e091586..e9d27b74c 100644 --- a/src/issuance.rs +++ b/src/issuance.rs @@ -24,7 +24,7 @@ use crate::{ asset_record::AssetRecord, bundle::commitments::{hash_issue_bundle_auth_data, hash_issue_bundle_txid_data}, constants::reference_keys::ReferenceKeys, - keys::{IssuanceAuthorizingKey, IssuanceValidatingKey}, + keys::{IssuanceAuthSigScheme, IssuanceAuthorizingKey, IssuanceValidatingKey}, note::{AssetBase, Nullifier, Rho}, value::NoteValue, Address, Note,