use crate::error::{Error, Result};
pub fn sm1() -> Result<()> {
Err(Error::UnsupportedNationalAlgorithm {
name: "SM1",
hint: "it is a non-public commercial block cipher; use a national-crypto HSM or the SDK from the chip vendor",
})
}
pub fn sm7() -> Result<()> {
Err(Error::UnsupportedNationalAlgorithm {
name: "SM7",
hint: "it targets RFID and similar fields; use the matching dedicated device or vendor interface",
})
}
pub fn sm9() -> Result<()> {
Err(Error::UnsupportedNationalAlgorithm {
name: "SM9",
hint: "it is a full identity-based cryptosystem requiring complete IBC protocols and key management; integrate a national-crypto middleware",
})
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn all_three_report_unsupported() {
for result in [sm1(), sm7(), sm9()] {
assert!(matches!(
result.unwrap_err(),
Error::UnsupportedNationalAlgorithm { .. }
));
}
}
}