PrivateKey
struct PrivateKey
Represents a whole RSA key, public and private parts.
operator !=
pub fn operator !=(self, b: PrivateKey): bool
operator !=
pub fn operator !=(self, b: PrivateKey): bool
operator ==
pub fn operator ==(self, b: PrivateKey): bool
operator ==
pub fn operator ==(self, b: PrivateKey): bool
new
pub fn new(bit_size: int, rng: Read = RandReader.new()): PrivateKey throws RsaError
[src]
pub fn new(bit_size: int, rng: Read = RandReader.new()): PrivateKey throws RsaError {
return try PrivateKey._new(bit_size, _create_native_read(rng));
}
Generate a new Rsa key pair of the given bit size.
new
pub fn new(bit_size: int, rng: Read = RandReader.new()): PrivateKey throws RsaError
[src]
pub fn new(bit_size: int, rng: Read = RandReader.new()): PrivateKey throws RsaError {
return try PrivateKey._new(bit_size, _create_native_read(rng));
}
Generate a new Rsa key pair of the given bit size.
Generate a new Rsa key pair of the given bit size.
Example
use std.crypto.rsa.PrivateKey;
let key = try! PrivateKey.new(2048);
parse_pkcs1_der
pub fn parse_pkcs1_der(data: Bytes): PrivateKey throws Pkcs1Error
Parse PKCS#1-encoded private key from ASN.1 DER-encoded data (binary format).
parse_pkcs1_der
pub fn parse_pkcs1_der(data: Bytes): PrivateKey throws Pkcs1Error
Parse PKCS#1-encoded private key from ASN.1 DER-encoded data (binary format).
Parse PKCS#1-encoded private key from ASN.1 DER-encoded data (binary format).
parse_pkcs1_pem
pub fn parse_pkcs1_pem(pem: string): PrivateKey throws Pkcs1Error
Parse PKCS#1-encoded private key from PEM.
parse_pkcs1_pem
pub fn parse_pkcs1_pem(pem: string): PrivateKey throws Pkcs1Error
Parse PKCS#1-encoded private key from PEM.
Parse PKCS#1-encoded private key from PEM.
parse_pkcs8_der
pub fn parse_pkcs8_der(data: Bytes): PrivateKey throws Pkcs8Error
Parse PKCS#8-encoded private key from ASN.1 DER-encoded data (binary format).
parse_pkcs8_der
pub fn parse_pkcs8_der(data: Bytes): PrivateKey throws Pkcs8Error
Parse PKCS#8-encoded private key from ASN.1 DER-encoded data (binary format).
Parse PKCS#8-encoded private key from ASN.1 DER-encoded data (binary format).
parse_pkcs8_pem
pub fn parse_pkcs8_pem(pem: string): PrivateKey throws Pkcs8Error
Parse PKCS#8-encoded private key from PEM.
parse_pkcs8_pem
pub fn parse_pkcs8_pem(pem: string): PrivateKey throws Pkcs8Error
Parse PKCS#8-encoded private key from PEM.
Parse PKCS#8-encoded private key from PEM.
decrypt_oeap
pub fn decrypt_oeap<T>(self, message: Bytes, label: string? = nil): Bytes throws RsaError
[src]
pub fn decrypt_oeap<T: Hash>(self, message: Bytes, label: string? = nil): Bytes throws RsaError {
return try self
._decrypt_oeap(_create_native_hash(T.new()), _create_native_hash(T.new()), message, label);
}
Encrypts the given message with RSA and the padding scheme from PKCS#1 OAEP.
decrypt_oeap
pub fn decrypt_oeap<T>(self, message: Bytes, label: string? = nil): Bytes throws RsaError
[src]
pub fn decrypt_oeap<T: Hash>(self, message: Bytes, label: string? = nil): Bytes throws RsaError {
return try self
._decrypt_oeap(_create_native_hash(T.new()), _create_native_hash(T.new()), message, label);
}
Encrypts the given message with RSA and the padding scheme from PKCS#1 OAEP.
Encrypts the given message with RSA and the padding scheme from PKCS#1 OAEP.
decrypt_pkcs1v15
pub fn decrypt_pkcs1v15(self, message: Bytes): Bytes throws RsaError
Decrypts a message using RSA and the padding scheme from PKCS#1 v1.5.
decrypt_pkcs1v15
pub fn decrypt_pkcs1v15(self, message: Bytes): Bytes throws RsaError
Decrypts a message using RSA and the padding scheme from PKCS#1 v1.5.
Decrypts a message using RSA and the padding scheme from PKCS#1 v1.5.
public_key
pub fn public_key(self): PublicKey
Get the public key from the private key.
public_key
pub fn public_key(self): PublicKey
Get the public key from the private key.
Get the public key from the private key.
sign_pkcs1v15
pub fn sign_pkcs1v15<T>(self, message: Bytes): Bytes throws RsaError
[src]
pub fn sign_pkcs1v15<T: Hash + AssociatedOid>(self, message: Bytes): Bytes throws RsaError {
let digest = T.new();
let oid = digest.oid();
return try self._sign_pkcs1v15(_create_native_hash(digest), oid.bytes(), message);
}
Calculates the signature of hashed using RSASSA-PKCS1-V1_5-SIGN from RSA PKCS#1 v1.5.
sign_pkcs1v15
pub fn sign_pkcs1v15<T>(self, message: Bytes): Bytes throws RsaError
[src]
pub fn sign_pkcs1v15<T: Hash + AssociatedOid>(self, message: Bytes): Bytes throws RsaError {
let digest = T.new();
let oid = digest.oid();
return try self._sign_pkcs1v15(_create_native_hash(digest), oid.bytes(), message);
}
Calculates the signature of hashed using RSASSA-PKCS1-V1_5-SIGN from RSA PKCS#1 v1.5.
Calculates the signature of hashed using RSASSA-PKCS1-V1_5-SIGN from RSA PKCS#1 v1.5.
[src]
pub fn sign_pss<T: Hash>(self, message: Bytes, salt_len: int? = nil): Bytes throws RsaError {
return try self._sign_pss(_create_native_hash(T.new()), message, salt_len);
}
Calculates the signature of hashed using PSS.
[src]
pub fn sign_pss<T: Hash>(self, message: Bytes, salt_len: int? = nil): Bytes throws RsaError {
return try self._sign_pss(_create_native_hash(T.new()), message, salt_len);
}
Calculates the signature of hashed using PSS.
Calculates the signature of hashed using PSS.
to_pkcs1_der
pub fn to_pkcs1_der(self): Bytes throws Pkcs1Error
Encode the PKCS#1-encoded private key to ASN.1 DER-encoded data (binary format).
to_pkcs1_der
pub fn to_pkcs1_der(self): Bytes throws Pkcs1Error
Encode the PKCS#1-encoded private key to ASN.1 DER-encoded data (binary format).
Encode the PKCS#1-encoded private key to ASN.1 DER-encoded data (binary format).
to_pkcs1_pem
pub fn to_pkcs1_pem(self): string throws Pkcs1Error
Encode the PKCS#1-encoded private key to PEM.
to_pkcs1_pem
pub fn to_pkcs1_pem(self): string throws Pkcs1Error
Encode the PKCS#1-encoded private key to PEM.
Encode the PKCS#1-encoded private key to PEM.
to_pkcs8_der
pub fn to_pkcs8_der(self): Bytes throws Pkcs8Error
Encode the PKCS#8-encoded private key to ASN.1 DER-encoded data (binary format).
to_pkcs8_der
pub fn to_pkcs8_der(self): Bytes throws Pkcs8Error
Encode the PKCS#8-encoded private key to ASN.1 DER-encoded data (binary format).
Encode the PKCS#8-encoded private key to ASN.1 DER-encoded data (binary format).
to_pkcs8_pem
pub fn to_pkcs8_pem(self): string throws Pkcs8Error
Encode the PKCS#8-encoded private key to PEM.
to_pkcs8_pem
pub fn to_pkcs8_pem(self): string throws Pkcs8Error
Encode the PKCS#8-encoded private key to PEM.
Encode the PKCS#8-encoded private key to PEM.