mirror of
https://github.com/chatmail/core.git
synced 2026-04-27 02:16:29 +03:00
key.rs: remove unsafe Key.from_binary
This commit is contained in:
10
src/key.rs
10
src/key.rs
@@ -1,7 +1,6 @@
|
||||
use std::collections::BTreeMap;
|
||||
use std::ffi::{CStr, CString};
|
||||
use std::io::Cursor;
|
||||
use std::slice;
|
||||
|
||||
use libc;
|
||||
use pgp::composed::{Deserializable, SignedPublicKey, SignedSecretKey};
|
||||
@@ -106,15 +105,6 @@ impl Key {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn from_binary(data: *const u8, len: libc::c_int, key_type: KeyType) -> Option<Self> {
|
||||
if data.is_null() || len == 0 {
|
||||
return None;
|
||||
}
|
||||
|
||||
let bytes = unsafe { slice::from_raw_parts(data, len as usize) };
|
||||
Self::from_slice(bytes, key_type)
|
||||
}
|
||||
|
||||
pub fn from_armored_string(
|
||||
data: &str,
|
||||
key_type: KeyType,
|
||||
|
||||
Reference in New Issue
Block a user