mirror of
https://github.com/chatmail/core.git
synced 2026-05-13 11:56:30 +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::collections::BTreeMap;
|
||||||
use std::ffi::{CStr, CString};
|
use std::ffi::{CStr, CString};
|
||||||
use std::io::Cursor;
|
use std::io::Cursor;
|
||||||
use std::slice;
|
|
||||||
|
|
||||||
use libc;
|
use libc;
|
||||||
use pgp::composed::{Deserializable, SignedPublicKey, SignedSecretKey};
|
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(
|
pub fn from_armored_string(
|
||||||
data: &str,
|
data: &str,
|
||||||
key_type: KeyType,
|
key_type: KeyType,
|
||||||
|
|||||||
Reference in New Issue
Block a user