Lines Matching refs:sig
501 pub fn to_cose_signature(curve: EcCurve, sig: Vec<u8>) -> Result<Vec<u8>, Error> { in to_cose_signature()
505 let der_sig = NistSignature::from_der(&sig) in to_cose_signature()
511 let mut sig = vec_try![0; 2 * l]?; in to_cose_signature() localVariable
516 sig[r_offset..r_offset + r.len()].copy_from_slice(r); in to_cose_signature()
517 sig[s_offset..s_offset + s.len()].copy_from_slice(s); in to_cose_signature()
518 Ok(sig) in to_cose_signature()
522 Ok(sig) in to_cose_signature()
528 pub fn from_cose_signature(curve: EcCurve, sig: &[u8]) -> Result<Vec<u8>, Error> { in from_cose_signature()
534 if sig.len() != 2 * l { in from_cose_signature()
538 sig.len(), in from_cose_signature()
545 r: der::asn1::UintRef::new(&sig[..l]) in from_cose_signature()
547 s: der::asn1::UintRef::new(&sig[l..]) in from_cose_signature()
556 try_to_vec(sig) in from_cose_signature()
580 let sig = NistSignature::from_der(&sig_data).expect("sequence should decode"); in test_sig_decode() localVariable
582 hex::encode(sig.r.as_bytes()), in test_sig_decode()
586 hex::encode(sig.s.as_bytes()), in test_sig_decode()