Virgil Security Crypto library  1.8.2
VirgilKeyPair.h
1 
37 #ifndef VIRGIL_KEY_PAIR_H
38 #define VIRGIL_KEY_PAIR_H
39 
40 #include <virgil/crypto/VirgilByteArray.h>
41 
42 namespace virgil { namespace crypto {
43 
48 public:
52  enum Type {
77  };
78 public:
84  static VirgilKeyPair generate(
86  const virgil::crypto::VirgilByteArray& pwd = virgil::crypto::VirgilByteArray());
87 
95  const VirgilKeyPair& donorKeyPair,
96  const virgil::crypto::VirgilByteArray& donorPrivateKeyPassword = virgil::crypto::VirgilByteArray(),
97  const virgil::crypto::VirgilByteArray& newKeyPairPassword = virgil::crypto::VirgilByteArray());
98 
103  static VirgilKeyPair ecNist192(const virgil::crypto::VirgilByteArray& pwd = virgil::crypto::VirgilByteArray());
104 
109  static VirgilKeyPair ecNist224(const virgil::crypto::VirgilByteArray& pwd = virgil::crypto::VirgilByteArray());
110 
115  static VirgilKeyPair ecNist256(const virgil::crypto::VirgilByteArray& pwd = virgil::crypto::VirgilByteArray());
116 
121  static VirgilKeyPair ecNist384(const virgil::crypto::VirgilByteArray& pwd = virgil::crypto::VirgilByteArray());
122 
127  static VirgilKeyPair ecNist521(const virgil::crypto::VirgilByteArray& pwd = virgil::crypto::VirgilByteArray());
128 
133  static VirgilKeyPair ecBrainpool256(const virgil::crypto::VirgilByteArray& pwd = virgil::crypto::VirgilByteArray());
134 
139  static VirgilKeyPair ecBrainpool384(const virgil::crypto::VirgilByteArray& pwd = virgil::crypto::VirgilByteArray());
140 
145  static VirgilKeyPair ecBrainpool512(const virgil::crypto::VirgilByteArray& pwd = virgil::crypto::VirgilByteArray());
146 
151  static VirgilKeyPair ecKoblitz192(const virgil::crypto::VirgilByteArray& pwd = virgil::crypto::VirgilByteArray());
152 
157  static VirgilKeyPair ecKoblitz224(const virgil::crypto::VirgilByteArray& pwd = virgil::crypto::VirgilByteArray());
158 
163  static VirgilKeyPair ecKoblitz256(const virgil::crypto::VirgilByteArray& pwd = virgil::crypto::VirgilByteArray());
164 
169  static VirgilKeyPair rsa256(const virgil::crypto::VirgilByteArray& pwd = virgil::crypto::VirgilByteArray());
170 
175  static VirgilKeyPair rsa512(const virgil::crypto::VirgilByteArray& pwd = virgil::crypto::VirgilByteArray());
176 
181  static VirgilKeyPair rsa1024(const virgil::crypto::VirgilByteArray& pwd = virgil::crypto::VirgilByteArray());
182 
187  static VirgilKeyPair rsa2048(const virgil::crypto::VirgilByteArray& pwd = virgil::crypto::VirgilByteArray());
188 
193  static VirgilKeyPair rsa4096(const virgil::crypto::VirgilByteArray& pwd = virgil::crypto::VirgilByteArray());
194 
198 
208  static bool isKeyPairMatch(
209  const virgil::crypto::VirgilByteArray& publicKey,
210  const virgil::crypto::VirgilByteArray& privateKey,
211  const virgil::crypto::VirgilByteArray& privateKeyPassword = virgil::crypto::VirgilByteArray());
212 
221  static bool checkPrivateKeyPassword(
222  const virgil::crypto::VirgilByteArray& key,
223  const virgil::crypto::VirgilByteArray& pwd);
224 
232  static bool isPrivateKeyEncrypted(const virgil::crypto::VirgilByteArray& privateKey);
234 
237 
249  static virgil::crypto::VirgilByteArray resetPrivateKeyPassword(
250  const virgil::crypto::VirgilByteArray& privateKey,
251  const virgil::crypto::VirgilByteArray& oldPassword, const virgil::crypto::VirgilByteArray& newPassword);
252 
261  static virgil::crypto::VirgilByteArray extractPublicKey(
262  const virgil::crypto::VirgilByteArray& privateKey,
263  const virgil::crypto::VirgilByteArray& privateKeyPassword);
265 
270  explicit VirgilKeyPair(const virgil::crypto::VirgilByteArray& pwd = virgil::crypto::VirgilByteArray());
271 
275  VirgilKeyPair(const virgil::crypto::VirgilByteArray& publicKey, const virgil::crypto::VirgilByteArray& privateKey);
276 
280  virgil::crypto::VirgilByteArray publicKey() const;
281 
285  virgil::crypto::VirgilByteArray privateKey() const;
290 private:
291  virgil::crypto::VirgilByteArray publicKey_;
292  virgil::crypto::VirgilByteArray privateKey_;
293 };
294 
295 }}
296 
297 #endif /* VIRGIL_KEY_PAIR_H */
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.