37 #ifndef VIRGIL_KEY_PAIR_H
38 #define VIRGIL_KEY_PAIR_H
40 #include <virgil/crypto/VirgilByteArray.h>
42 namespace virgil {
namespace crypto {
86 const virgil::crypto::VirgilByteArray& pwd = virgil::crypto::VirgilByteArray());
96 const virgil::crypto::VirgilByteArray& donorPrivateKeyPassword = virgil::crypto::VirgilByteArray(),
97 const virgil::crypto::VirgilByteArray& newKeyPairPassword = virgil::crypto::VirgilByteArray());
103 static VirgilKeyPair ecNist192(
const virgil::crypto::VirgilByteArray& pwd = virgil::crypto::VirgilByteArray());
109 static VirgilKeyPair ecNist224(
const virgil::crypto::VirgilByteArray& pwd = virgil::crypto::VirgilByteArray());
115 static VirgilKeyPair ecNist256(
const virgil::crypto::VirgilByteArray& pwd = virgil::crypto::VirgilByteArray());
121 static VirgilKeyPair ecNist384(
const virgil::crypto::VirgilByteArray& pwd = virgil::crypto::VirgilByteArray());
127 static VirgilKeyPair ecNist521(
const virgil::crypto::VirgilByteArray& pwd = virgil::crypto::VirgilByteArray());
169 static VirgilKeyPair rsa256(
const virgil::crypto::VirgilByteArray& pwd = virgil::crypto::VirgilByteArray());
175 static VirgilKeyPair rsa512(
const virgil::crypto::VirgilByteArray& pwd = virgil::crypto::VirgilByteArray());
181 static VirgilKeyPair rsa1024(
const virgil::crypto::VirgilByteArray& pwd = virgil::crypto::VirgilByteArray());
187 static VirgilKeyPair rsa2048(
const virgil::crypto::VirgilByteArray& pwd = virgil::crypto::VirgilByteArray());
193 static VirgilKeyPair rsa4096(
const virgil::crypto::VirgilByteArray& pwd = virgil::crypto::VirgilByteArray());
209 const virgil::crypto::VirgilByteArray&
publicKey,
210 const virgil::crypto::VirgilByteArray&
privateKey,
211 const virgil::crypto::VirgilByteArray& privateKeyPassword = virgil::crypto::VirgilByteArray());
222 const virgil::crypto::VirgilByteArray& key,
223 const virgil::crypto::VirgilByteArray& pwd);
250 const virgil::crypto::VirgilByteArray& privateKey,
251 const virgil::crypto::VirgilByteArray& oldPassword,
const virgil::crypto::VirgilByteArray& newPassword);
262 const virgil::crypto::VirgilByteArray& privateKey,
263 const virgil::crypto::VirgilByteArray& privateKeyPassword);
270 explicit VirgilKeyPair(
const virgil::crypto::VirgilByteArray& pwd = virgil::crypto::VirgilByteArray());
275 VirgilKeyPair(
const virgil::crypto::VirgilByteArray& publicKey,
const virgil::crypto::VirgilByteArray& privateKey);
280 virgil::crypto::VirgilByteArray
publicKey()
const;
285 virgil::crypto::VirgilByteArray
privateKey()
const;
291 virgil::crypto::VirgilByteArray publicKey_;
292 virgil::crypto::VirgilByteArray privateKey_;
RSA 1024 bit (not recommended)
Definition: VirgilKeyPair.h:54
static VirgilKeyPair rsa4096(const virgil::crypto::VirgilByteArray &pwd=virgil::crypto::VirgilByteArray())
Generate new key pair with RSA 4096-bits.
static VirgilKeyPair generate(VirgilKeyPair::Type type=VirgilKeyPair::Type_Default, const virgil::crypto::VirgilByteArray &pwd=virgil::crypto::VirgilByteArray())
Generate new key pair given type.
256-bits "Koblitz" curve
Definition: VirgilKeyPair.h:76
static VirgilKeyPair generateFrom(const VirgilKeyPair &donorKeyPair, const virgil::crypto::VirgilByteArray &donorPrivateKeyPassword=virgil::crypto::VirgilByteArray(), const virgil::crypto::VirgilByteArray &newKeyPairPassword=virgil::crypto::VirgilByteArray())
Generate new key pair of the same type based on the donor key pair.
256-bits NIST curve
Definition: VirgilKeyPair.h:63
static bool isKeyPairMatch(const virgil::crypto::VirgilByteArray &publicKey, const virgil::crypto::VirgilByteArray &privateKey, const virgil::crypto::VirgilByteArray &privateKeyPassword=virgil::crypto::VirgilByteArray())
Check if a public-private pair of keys matches.
static VirgilKeyPair ecKoblitz224(const virgil::crypto::VirgilByteArray &pwd=virgil::crypto::VirgilByteArray())
Generate new key pair with 224-bits "Koblitz" curve.
RSA 2048 bit (not recommended)
Definition: VirgilKeyPair.h:57
192-bits "Koblitz" curve
Definition: VirgilKeyPair.h:74
224-bits NIST curve
Definition: VirgilKeyPair.h:62
224-bits "Koblitz" curve
Definition: VirgilKeyPair.h:75
(not implemented yet)
Definition: VirgilKeyPair.h:69
static virgil::crypto::VirgilByteArray resetPrivateKeyPassword(const virgil::crypto::VirgilByteArray &privateKey, const virgil::crypto::VirgilByteArray &oldPassword, const virgil::crypto::VirgilByteArray &newPassword)
Reset password for the given private key.
virgil::crypto::VirgilByteArray privateKey() const
Provide access to the private key.
static VirgilKeyPair ecBrainpool512(const virgil::crypto::VirgilByteArray &pwd=virgil::crypto::VirgilByteArray())
Generate new key pair with 512-bits Brainpool curve.
Type
Type of the keypair.
Definition: VirgilKeyPair.h:52
static VirgilKeyPair ecKoblitz192(const virgil::crypto::VirgilByteArray &pwd=virgil::crypto::VirgilByteArray())
Generate new key pair with 192-bits "Koblitz" curve.
static VirgilKeyPair ecBrainpool256(const virgil::crypto::VirgilByteArray &pwd=virgil::crypto::VirgilByteArray())
Generate new key pair with 256-bits Brainpool curve.
static VirgilKeyPair ecKoblitz256(const virgil::crypto::VirgilByteArray &pwd=virgil::crypto::VirgilByteArray())
Generate new key pair with 256-bits "Koblitz" curve.
Definition: VirgilAsn1Compatible.h:46
static VirgilKeyPair ecBrainpool384(const virgil::crypto::VirgilByteArray &pwd=virgil::crypto::VirgilByteArray())
Generate new key pair with 384-bits Brainpool curve.
static bool checkPrivateKeyPassword(const virgil::crypto::VirgilByteArray &key, const virgil::crypto::VirgilByteArray &pwd)
Check if given private key and it's password matches.
(not implemented yet)
Definition: VirgilKeyPair.h:73
static VirgilKeyPair ecNist192(const virgil::crypto::VirgilByteArray &pwd=virgil::crypto::VirgilByteArray())
Generate new key pair with 192-bits NIST curve.
RSA 4096 bit.
Definition: VirgilKeyPair.h:59
static VirgilKeyPair ecNist521(const virgil::crypto::VirgilByteArray &pwd=virgil::crypto::VirgilByteArray())
Generate new key pair with 521-bits NIST curve.
192-bits NIST curve
Definition: VirgilKeyPair.h:61
static virgil::crypto::VirgilByteArray extractPublicKey(const virgil::crypto::VirgilByteArray &privateKey, const virgil::crypto::VirgilByteArray &privateKeyPassword)
Extract public key from the private key.
This class handles information about Virgil Security key pair.
Definition: VirgilKeyPair.h:47
Curve25519.
Definition: VirgilKeyPair.h:71
virgil::crypto::VirgilByteArray publicKey() const
Provide access to the public key.
RSA 1024 bit (not recommended)
Definition: VirgilKeyPair.h:56
256-bits Brainpool curve
Definition: VirgilKeyPair.h:66
static VirgilKeyPair rsa512(const virgil::crypto::VirgilByteArray &pwd=virgil::crypto::VirgilByteArray())
Generate new key pair with RSA 512-bits.
static VirgilKeyPair ecNist224(const virgil::crypto::VirgilByteArray &pwd=virgil::crypto::VirgilByteArray())
Generate new key pair with 224-bits NIST curve.
521-bits NIST curve
Definition: VirgilKeyPair.h:65
384-bits Brainpool curve
Definition: VirgilKeyPair.h:67
RSA 3072 bit.
Definition: VirgilKeyPair.h:58
static VirgilKeyPair rsa2048(const virgil::crypto::VirgilByteArray &pwd=virgil::crypto::VirgilByteArray())
Generate new key pair with RSA 2048-bits.
static VirgilKeyPair ecNist384(const virgil::crypto::VirgilByteArray &pwd=virgil::crypto::VirgilByteArray())
Generate new key pair with 384-bits NIST curve.
VirgilKeyPair(const virgil::crypto::VirgilByteArray &pwd=virgil::crypto::VirgilByteArray())
Generate new key pair with default settings.
recommended most safe type
Definition: VirgilKeyPair.h:53
static VirgilKeyPair rsa1024(const virgil::crypto::VirgilByteArray &pwd=virgil::crypto::VirgilByteArray())
Generate new key pair with RSA 1024-bits.
Curve25519.
Definition: VirgilKeyPair.h:70
512-bits Brainpool curve
Definition: VirgilKeyPair.h:68
(not implemented yet)
Definition: VirgilKeyPair.h:72
384-bits NIST curve
Definition: VirgilKeyPair.h:64
static VirgilKeyPair ecNist256(const virgil::crypto::VirgilByteArray &pwd=virgil::crypto::VirgilByteArray())
Generate new key pair with 256-bits NIST curve.
RSA 8192 bit.
Definition: VirgilKeyPair.h:60
RSA 1024 bit (not recommended)
Definition: VirgilKeyPair.h:55
static VirgilKeyPair rsa256(const virgil::crypto::VirgilByteArray &pwd=virgil::crypto::VirgilByteArray())
Generate new key pair with RSA 256-bits.
static bool isPrivateKeyEncrypted(const virgil::crypto::VirgilByteArray &privateKey)
Check if given private key is encrypted.