37 #ifndef VIRGIL_KEY_PAIR_H
38 #define VIRGIL_KEY_PAIR_H
40 #include "VirgilByteArray.h"
42 namespace virgil {
namespace crypto {
static bool isPrivateKeyEncrypted(const VirgilByteArray &privateKey)
Check if given private key is encrypted.
Curve25519 as ECP deprecated format.
static VirgilKeyPair generate(VirgilKeyPair::Type type, const VirgilByteArray &pwd=VirgilByteArray())
Generate new key pair given type.
static bool checkPrivateKeyPassword(const VirgilByteArray &key, const VirgilByteArray &pwd)
Check if given private key and it's password matches.
static VirgilKeyPair generateRecommendedFromKeyMaterial(const VirgilByteArray &keyMaterial, const VirgilByteArray &pwd=VirgilByteArray())
Generates recommended private and public keys from the given key material.
Type
Specific key algorithm type.
Definition: VirgilKeyPair.h:78
static VirgilByteArray privateKeyToDER(const VirgilByteArray &privateKey, const VirgilByteArray &privateKeyPassword=VirgilByteArray())
Convert given private key to the DER format.
static VirgilKeyPair generateFromKeyMaterial(VirgilKeyPair::Type type, const VirgilByteArray &keyMaterial, const VirgilByteArray &pwd=VirgilByteArray())
Generates private and public keys from the given key material.
std::vector< unsigned char > VirgilByteArray
This type represents a sequence of bytes.
Definition: VirgilByteArray.h:50
static bool isKeyPairMatch(const VirgilByteArray &publicKey, const VirgilByteArray &privateKey, const VirgilByteArray &privateKeyPassword=VirgilByteArray())
Check if a public-private pair of keys matches.
static VirgilByteArray publicKeyToDER(const VirgilByteArray &publicKey)
Convert given public key to the DER format.
This class handles information about Virgil Security key pair.
Definition: VirgilKeyPair.h:47
static VirgilByteArray extractPublicKey(const VirgilByteArray &privateKey, const VirgilByteArray &privateKeyPassword)
Extract public key from the private key.
static VirgilByteArray publicKeyToPEM(const VirgilByteArray &publicKey)
Convert given public key to the PEM format.
static VirgilByteArray decryptPrivateKey(const VirgilByteArray &privateKey, const VirgilByteArray &privateKeyPassword)
Return plain (non encrypted) private key.
static VirgilKeyPair generateFrom(const VirgilKeyPair &donorKeyPair, const VirgilByteArray &donorPrivateKeyPassword=VirgilByteArray(), const VirgilByteArray &newKeyPairPassword=VirgilByteArray())
Generate new key pair of the same type based on the donor key pair.
static VirgilByteArray encryptPrivateKey(const VirgilByteArray &privateKey, const VirgilByteArray &privateKeyPassword)
Return encrypted private key in PKCS#8 format.
VirgilKeyPair(const VirgilByteArray &publicKey, const VirgilByteArray &privateKey)
Initialize key pair with given public and private key.
static VirgilByteArray privateKeyToPEM(const VirgilByteArray &privateKey, const VirgilByteArray &privateKeyPassword=VirgilByteArray())
Convert given private key to the PEM format.
static VirgilByteArray resetPrivateKeyPassword(const VirgilByteArray &privateKey, const VirgilByteArray &oldPassword, const VirgilByteArray &newPassword)
Reset password for the given private key.
static VirgilKeyPair generateRecommended(const VirgilByteArray &pwd=VirgilByteArray())
Generate new key pair with recommended most safe type.
VirgilByteArray publicKey() const
Provide access to the public key.
VirgilByteArray privateKey() const
Provide access to the private key.