[−][src]Struct gbl::P256PublicKey
A public P-256 key (aka secp256r1 / prime256v1).
Methods
impl P256PublicKey
[src]
pub fn from_der<D: AsRef<[u8]>>(der: D) -> Result<Self, Error>
[src]
Decodes a P-256 public key from a DER-encoded SubjectPublicKeyInfo
structure.
The SubjectPublicKeyInfo
structure is described in RFC 5280.
Examples
let der = [ 0x30, 0x59, 0x30, 0x13, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07, 0x03, 0x42, 0x00, 0x04, 0xdc, 0xc7, 0xaf, 0xdd, 0x92, 0xe7, 0xc2, 0x0b, 0xfe, 0xbb, 0xd7, 0x08, 0x45, 0xb3, 0x4e, 0x92, 0xea, 0x2d, 0x52, 0xc3, 0x38, 0xaa, 0x9b, 0x68, 0xe8, 0x2b, 0x6c, 0x82, 0x37, 0x77, 0x29, 0x8f, 0x23, 0x69, 0x39, 0xef, 0x32, 0x72, 0x4c, 0x43, 0x44, 0xc8, 0x5f, 0x06, 0x6a, 0x6f, 0x37, 0xb1, 0x3e, 0x35, 0x8f, 0x8a, 0xe5, 0x99, 0x61, 0x99, 0x3d, 0x1e, 0x63, 0x6d, 0x68, 0x5c, 0xc1, 0xe2 ]; let pubkey = P256PublicKey::from_der(&der[..])?;
pub fn from_pem<P: AsRef<str>>(pem: P) -> Result<Self, Error>
[src]
Decodes a P-256 public key from a PEM-encoded SubjectPublicKeyInfo
structure.
The PEM data should have a header of -----BEGIN PUBLIC KEY-----
.
The SubjectPublicKeyInfo
structure is described in RFC 5280.
Examples
let pem = r#" -----BEGIN PUBLIC KEY----- MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE3Mev3ZLnwgv+u9cIRbNOkuotUsM4 qpto6Ctsgjd3KY8jaTnvMnJMQ0TIXwZqbzexPjWPiuWZYZk9HmNtaFzB4g== -----END PUBLIC KEY----- "#; let pubkey = P256PublicKey::from_pem(pem)?;
Auto Trait Implementations
impl Sync for P256PublicKey
impl Send for P256PublicKey
impl Unpin for P256PublicKey
impl RefUnwindSafe for P256PublicKey
impl UnwindSafe for P256PublicKey
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,