Home
last modified time | relevance | path

Searched refs:rsa (Results 1 – 25 of 165) sorted by relevance

1234567

/external/boringssl/src/crypto/rsa/
Drsa.c79 RSA *rsa = (RSA *)OPENSSL_malloc(sizeof(RSA)); in RSA_new_method() local
80 if (rsa == NULL) { in RSA_new_method()
85 memset(rsa, 0, sizeof(RSA)); in RSA_new_method()
88 rsa->meth = ENGINE_get_RSA_method(engine); in RSA_new_method()
91 if (rsa->meth == NULL) { in RSA_new_method()
92 rsa->meth = (RSA_METHOD*) &RSA_default_method; in RSA_new_method()
94 METHOD_ref(rsa->meth); in RSA_new_method()
96 rsa->references = 1; in RSA_new_method()
97 rsa->flags = rsa->meth->flags; in RSA_new_method()
98 CRYPTO_MUTEX_init(&rsa->lock); in RSA_new_method()
[all …]
Drsa_impl.c76 size_t rsa_default_size(const RSA *rsa) { in rsa_default_size() argument
77 return BN_num_bytes(rsa->n); in rsa_default_size()
80 int rsa_default_encrypt(RSA *rsa, size_t *out_len, uint8_t *out, size_t max_out, in rsa_default_encrypt() argument
82 const unsigned rsa_size = RSA_size(rsa); in rsa_default_encrypt()
98 if (BN_ucmp(rsa->n, rsa->e) <= 0) { in rsa_default_encrypt()
104 if (BN_num_bits(rsa->n) > OPENSSL_RSA_SMALL_MODULUS_BITS && in rsa_default_encrypt()
105 BN_num_bits(rsa->e) > OPENSSL_RSA_MAX_PUBEXP_BITS) { in rsa_default_encrypt()
149 if (BN_ucmp(f, rsa->n) >= 0) { in rsa_default_encrypt()
155 if (rsa->flags & RSA_FLAG_CACHE_PUBLIC) { in rsa_default_encrypt()
156 if (BN_MONT_CTX_set_locked(&rsa->mont_n, &rsa->lock, rsa->n, ctx) == NULL) { in rsa_default_encrypt()
[all …]
Drsa_test.cc613 ScopedRSA rsa(d2i_RSAPrivateKey(nullptr, &der, der_size)); in TestMultiPrimeKey() local
614 if (!rsa) { in TestMultiPrimeKey()
620 if (!RSA_check_key(rsa.get())) { in TestMultiPrimeKey()
628 if (!RSA_decrypt(rsa.get(), &out_len, out, sizeof(out), enc, enc_size, in TestMultiPrimeKey()
646 ScopedRSA rsa(RSA_new()); in TestMultiPrimeKeygen() local
648 if (!rsa || !e || in TestMultiPrimeKeygen()
650 !RSA_generate_multi_prime_key(rsa.get(), kBits, 3, e.get(), nullptr) || in TestMultiPrimeKeygen()
651 !RSA_check_key(rsa.get()) || in TestMultiPrimeKeygen()
652 !RSA_encrypt(rsa.get(), &encrypted_len, encrypted, sizeof(encrypted), in TestMultiPrimeKeygen()
655 !RSA_decrypt(rsa.get(), &decrypted_len, decrypted, sizeof(decrypted), in TestMultiPrimeKeygen()
[all …]
Drsa_asn1.c146 int RSA_marshal_public_key(CBB *cbb, const RSA *rsa) { in RSA_marshal_public_key() argument
149 !marshal_integer(&child, rsa->n) || in RSA_marshal_public_key()
150 !marshal_integer(&child, rsa->e) || in RSA_marshal_public_key()
159 const RSA *rsa) { in RSA_public_key_to_bytes() argument
163 !RSA_marshal_public_key(&cbb, rsa) || in RSA_public_key_to_bytes()
305 int RSA_marshal_private_key(CBB *cbb, const RSA *rsa) { in RSA_marshal_private_key() argument
307 sk_RSA_additional_prime_num(rsa->additional_primes) > 0; in RSA_marshal_private_key()
313 !marshal_integer(&child, rsa->n) || in RSA_marshal_private_key()
314 !marshal_integer(&child, rsa->e) || in RSA_marshal_private_key()
315 !marshal_integer(&child, rsa->d) || in RSA_marshal_private_key()
[all …]
Dinternal.h72 size_t rsa_default_size(const RSA *rsa);
73 int rsa_default_encrypt(RSA *rsa, size_t *out_len, uint8_t *out, size_t max_out,
75 int rsa_default_sign_raw(RSA *rsa, size_t *out_len, uint8_t *out,
78 int rsa_default_decrypt(RSA *rsa, size_t *out_len, uint8_t *out, size_t max_out,
80 int rsa_default_verify_raw(RSA *rsa, size_t *out_len, uint8_t *out,
83 int rsa_default_private_transform(RSA *rsa, uint8_t *out, const uint8_t *in,
85 int rsa_default_multi_prime_keygen(RSA *rsa, int bits, int num_primes,
87 int rsa_default_keygen(RSA *rsa, int bits, BIGNUM *e_value, BN_GENCB *cb);
111 BN_BLINDING *rsa_setup_blinding(RSA *rsa, BN_CTX *in_ctx);
136 int RSA_private_transform(RSA *rsa, uint8_t *out, const uint8_t *in,
Dblinding.c402 BN_BLINDING *rsa_setup_blinding(RSA *rsa, BN_CTX *in_ctx) { in rsa_setup_blinding() argument
425 if (rsa->e == NULL) { in rsa_setup_blinding()
426 e = rsa_get_public_exp(rsa->d, rsa->p, rsa->q, ctx); in rsa_setup_blinding()
432 e = rsa->e; in rsa_setup_blinding()
436 BN_with_flags(n, rsa->n, BN_FLG_CONSTTIME); in rsa_setup_blinding()
438 if (rsa->flags & RSA_FLAG_CACHE_PUBLIC) { in rsa_setup_blinding()
439 mont_ctx = BN_MONT_CTX_set_locked(&rsa->mont_n, &rsa->lock, rsa->n, ctx); in rsa_setup_blinding()
445 ret = BN_BLINDING_create_param(NULL, e, n, ctx, rsa->meth->bn_mod_exp, in rsa_setup_blinding()
457 if (rsa->e == NULL) { in rsa_setup_blinding()
/external/vboot_reference/tests/
Dvboot_common2_tests.c21 RSAPublicKey *rsa; in VerifyPublicKeyToRSA() local
34 rsa = PublicKeyToRSA(orig_key); in VerifyPublicKeyToRSA()
35 TEST_NEQ((size_t)rsa, 0, "PublicKeyToRSA() ok"); in VerifyPublicKeyToRSA()
36 if (rsa) { in VerifyPublicKeyToRSA()
37 TEST_EQ((int)rsa->algorithm, (int)key->algorithm, in VerifyPublicKeyToRSA()
39 RSAPublicKeyFree(rsa); in VerifyPublicKeyToRSA()
49 RSAPublicKey *rsa; in VerifyDataTest() local
54 rsa = PublicKeyToRSA(public_key); in VerifyDataTest()
55 TEST_PTR_NEQ(rsa, 0, "VerifyData() calculate rsa"); in VerifyDataTest()
57 if (!sig || !rsa) in VerifyDataTest()
[all …]
Dvboot_common3_tests.c172 RSAPublicKey *rsa; in VerifyFirmwarePreambleTest() local
178 rsa = PublicKeyToRSA(public_key); in VerifyFirmwarePreambleTest()
181 TEST_NEQ(hdr && rsa, 0, "VerifyFirmwarePreamble() prerequisites"); in VerifyFirmwarePreambleTest()
187 TEST_EQ(VerifyFirmwarePreamble(hdr, hsize, rsa), 0, in VerifyFirmwarePreambleTest()
189 TEST_NEQ(VerifyFirmwarePreamble(hdr, 4, rsa), 0, in VerifyFirmwarePreambleTest()
191 TEST_NEQ(VerifyFirmwarePreamble(hdr, hsize - 1, rsa), 0, in VerifyFirmwarePreambleTest()
193 TEST_EQ(VerifyFirmwarePreamble(hdr, hsize + 1, rsa), 0, in VerifyFirmwarePreambleTest()
200 TEST_NEQ(VerifyFirmwarePreamble(h, hsize, rsa), 0, in VerifyFirmwarePreambleTest()
206 TEST_NEQ(VerifyFirmwarePreamble(h, hsize, rsa), 0, in VerifyFirmwarePreambleTest()
212 TEST_EQ(VerifyFirmwarePreamble(h, hsize, rsa), 0, in VerifyFirmwarePreambleTest()
[all …]
Dvb20_common3_tests.c178 struct vb2_public_key rsa; in test_verify_fw_preamble() local
189 TEST_SUCC(vb2_unpack_key(&rsa, (uint8_t *)public_key, in test_verify_fw_preamble()
204 TEST_SUCC(vb2_verify_fw_preamble(h, hsize, &rsa, &wb), in test_verify_fw_preamble()
208 TEST_EQ(vb2_verify_fw_preamble(h, 4, &rsa, &wb), in test_verify_fw_preamble()
213 TEST_EQ(vb2_verify_fw_preamble(h, hsize - 1, &rsa, &wb), in test_verify_fw_preamble()
219 TEST_SUCC(vb2_verify_fw_preamble(h, hsize + 1, &rsa, &wb), in test_verify_fw_preamble()
226 TEST_EQ(vb2_verify_fw_preamble(h, hsize, &rsa, &wb), in test_verify_fw_preamble()
233 TEST_EQ(vb2_verify_fw_preamble(h, hsize, &rsa, &wb), in test_verify_fw_preamble()
240 TEST_SUCC(vb2_verify_fw_preamble(h, hsize, &rsa, &wb), in test_verify_fw_preamble()
246 TEST_EQ(vb2_verify_fw_preamble(h, hsize, &rsa, &wb), in test_verify_fw_preamble()
[all …]
/external/boringssl/src/include/openssl/
Drsa.h85 OPENSSL_EXPORT void RSA_free(RSA *rsa);
88 OPENSSL_EXPORT int RSA_up_ref(RSA *rsa);
101 OPENSSL_EXPORT int RSA_generate_key_ex(RSA *rsa, int bits, BIGNUM *e,
106 OPENSSL_EXPORT int RSA_generate_multi_prime_key(RSA *rsa, int bits,
129 OPENSSL_EXPORT int RSA_encrypt(RSA *rsa, size_t *out_len, uint8_t *out,
148 OPENSSL_EXPORT int RSA_decrypt(RSA *rsa, size_t *out_len, uint8_t *out,
162 uint8_t *to, RSA *rsa, int padding);
175 uint8_t *to, RSA *rsa, int padding);
192 unsigned int *out_len, RSA *rsa);
203 OPENSSL_EXPORT int RSA_sign_raw(RSA *rsa, size_t *out_len, uint8_t *out,
[all …]
/external/boringssl/src/crypto/evp/
Dp_rsa_asn1.c75 if (!RSA_public_key_to_bytes(&encoded, &encoded_len, pkey->pkey.rsa)) { in rsa_pub_encode()
103 RSA *rsa = RSA_parse_public_key_buggy(&cbs); in rsa_pub_decode() local
104 if (rsa == NULL || CBS_len(&cbs) != 0) { in rsa_pub_decode()
106 RSA_free(rsa); in rsa_pub_decode()
110 EVP_PKEY_assign_RSA(pkey, rsa); in rsa_pub_decode()
115 return BN_cmp(b->pkey.rsa->n, a->pkey.rsa->n) == 0 && in rsa_pub_cmp()
116 BN_cmp(b->pkey.rsa->e, a->pkey.rsa->e) == 0; in rsa_pub_cmp()
122 if (!RSA_private_key_to_bytes(&encoded, &encoded_len, pkey->pkey.rsa)) { in rsa_priv_encode()
145 RSA *rsa = RSA_private_key_from_bytes(p, pklen); in rsa_priv_decode() local
146 if (rsa == NULL) { in rsa_priv_decode()
[all …]
Dp_rsa.c168 RSA *rsa = ctx->pkey->pkey.rsa; in pkey_rsa_sign() local
196 if (!RSA_sign(EVP_MD_type(rctx->md), tbs, tbslen, sig, &out_len, rsa)) { in pkey_rsa_sign()
204 !RSA_padding_add_PKCS1_PSS_mgf1(rsa, rctx->tbuf, tbs, rctx->md, in pkey_rsa_sign()
206 !RSA_sign_raw(rsa, siglen, sig, *siglen, rctx->tbuf, key_len, in pkey_rsa_sign()
217 return RSA_sign_raw(rsa, siglen, sig, *siglen, tbs, tbslen, rctx->pad_mode); in pkey_rsa_sign()
224 RSA *rsa = ctx->pkey->pkey.rsa; in pkey_rsa_verify() local
231 return RSA_verify(EVP_MD_type(rctx->md), tbs, tbslen, sig, siglen, rsa); in pkey_rsa_verify()
235 !RSA_verify_raw(rsa, &rslen, rctx->tbuf, key_len, sig, siglen, in pkey_rsa_verify()
237 !RSA_verify_PKCS1_PSS_mgf1(rsa, tbs, rctx->md, rctx->mgf1md, in pkey_rsa_verify()
249 !RSA_verify_raw(rsa, &rslen, rctx->tbuf, key_len, sig, siglen, in pkey_rsa_verify()
[all …]
/external/chromium-trace/catapult/third_party/gsutil/third_party/rsa/doc/
Dreference.rst10 .. autofunction:: rsa.encrypt
12 .. autofunction:: rsa.decrypt
14 .. autofunction:: rsa.sign
16 .. autofunction:: rsa.verify
18 .. autofunction:: rsa.newkeys(keysize)
24 .. autoclass:: rsa.PublicKey
28 .. autoclass:: rsa.PrivateKey
35 .. autoclass:: rsa.pkcs1.CryptoError(Exception)
37 .. autoclass:: rsa.pkcs1.DecryptionError(CryptoError)
39 .. autoclass:: rsa.pkcs1.VerificationError(CryptoError)
[all …]
Dupgrading.rst10 import rsa._version133 as rsa
14 import rsa._version200 as rsa
20 import rsa._version200 as rsa200
21 import rsa # this imports version 3.0
24 new_crypto = rsa.encrypt(decrypted, version_3_public_key)
31 You can either generate a new key with :py:func:`rsa.newkeys`, or use
32 :py:func:`rsa.bigfile.encrypt_bigfile` to encrypt your files.
41 import rsa
56 pub_key = rsa.PublicKey(n=old_pub_key['n'], e=old_pub_key['e'])
58 priv_key = rsa.PrivateKey(n=old_pub_key['n'], e=old_pub_key['e'],
[all …]
Dusage.rst29 You can use the :py:func:`rsa.newkeys` function to create a keypair:
31 >>> (pubkey, privkey) = rsa.newkeys(512)
33 Alternatively you can use :py:meth:`rsa.PrivateKey.load_pkcs1` and
34 :py:meth:`rsa.PublicKey.load_pkcs1` to load keys from a file:
38 >>> pubkey = rsa.PrivateKey.load_pkcs1(keydata)
58 >>> (pubkey, privkey) = rsa.newkeys(512, poolsize=8)
120 To encrypt or decrypt a message, use :py:func:`rsa.encrypt` resp.
121 :py:func:`rsa.decrypt`. Let's say that Alice wants to send a message
128 >>> (bob_pub, bob_priv) = rsa.newkeys(512)
137 >>> crypto = rsa.encrypt(message, bob_pub)
[all …]
Dinstallation.rst7 pip install rsa
8 easy_install rsa
26 .. _`Mercurial repository`: https://bitbucket.org/sybren/python-rsa
28 https://bitbucket.org/sybren/python-rsa/issues?status=new&status=open
47 virtualenv python-rsa-venv-py2x
48 . python-rsa-venv-py2x/bin/activate
49 pip install -r python-rsa/requirements-dev-py2x.txt
53 virtualenv python-rsa-venv-py3x
54 . python-rsa-venv-py3x/bin/activate
55 pip install -r python-rsa/requirements-dev-py3x.txt
[all …]
/external/chromium-trace/catapult/third_party/gsutil/third_party/rsa/tests/
Dtest_load_save_keys.py5 from rsa._compat import b
7 import rsa.key
62 key = rsa.key.PrivateKey.load_pkcs1(PRIVATE_DER, 'DER')
63 expected = rsa.key.PrivateKey(3727264081, 65537, 3349121513, 65063, 57287)
70 key = rsa.key.PrivateKey(3727264081, 65537, 3349121513, 65063, 57287)
78 key = rsa.key.PublicKey.load_pkcs1(PUBLIC_DER, 'DER')
79 expected = rsa.key.PublicKey(3727264081, 65537)
86 key = rsa.key.PublicKey(3727264081, 65537)
98 key = rsa.key.PrivateKey.load_pkcs1(PRIVATE_PEM, 'PEM')
99 expected = rsa.key.PrivateKey(3727264081, 65537, 3349121513, 65063, 57287)
[all …]
Dtest_integers.py5 import rsa.core
10 (self.pub, self.priv) = rsa.newkeys(64)
17 encrypted = rsa.core.encrypt_int(message, self.pub.e, self.pub.n)
20 decrypted = rsa.core.decrypt_int(encrypted, self.priv.d, self.pub.n)
29 signed = rsa.core.encrypt_int(message,self.priv.d, self.pub.n)
32 verified = rsa.core.decrypt_int(signed, self.pub.e,self.pub.n)
/external/boringssl/src/ssl/
Dssl_rsa.c103 int SSL_use_RSAPrivateKey(SSL *ssl, RSA *rsa) { in SSL_use_RSAPrivateKey() argument
107 if (rsa == NULL) { in SSL_use_RSAPrivateKey()
118 RSA_up_ref(rsa); in SSL_use_RSAPrivateKey()
119 EVP_PKEY_assign_RSA(pkey, rsa); in SSL_use_RSAPrivateKey()
151 RSA *rsa = RSA_private_key_from_bytes(der, der_len); in SSL_use_RSAPrivateKey_ASN1() local
152 if (rsa == NULL) { in SSL_use_RSAPrivateKey_ASN1()
157 int ret = SSL_use_RSAPrivateKey(ssl, rsa); in SSL_use_RSAPrivateKey_ASN1()
158 RSA_free(rsa); in SSL_use_RSAPrivateKey_ASN1()
259 int SSL_CTX_use_RSAPrivateKey(SSL_CTX *ctx, RSA *rsa) { in SSL_CTX_use_RSAPrivateKey() argument
263 if (rsa == NULL) { in SSL_CTX_use_RSAPrivateKey()
[all …]
/external/chromium-trace/catapult/third_party/gsutil/third_party/rsa/rsa/
Dcli.py28 import rsa
29 import rsa.bigfile
30 import rsa.pkcs1
32 HASH_METHODS = sorted(rsa.pkcs1.HASH_METHODS.keys())
68 (pub_key, priv_key) = rsa.newkeys(keysize)
108 key_class = rsa.PublicKey
210 return rsa.encrypt(indata, pub_key)
222 key_class = rsa.PrivateKey
227 return rsa.decrypt(indata, priv_key)
239 key_class = rsa.PrivateKey
[all …]
Dkey.py29 from rsa._compat import b, bytes_type
31 import rsa.prime
32 import rsa.pem
33 import rsa.common
158 from rsa.asn1 import AsnPubKey
170 from rsa.asn1 import AsnPubKey
191 der = rsa.pem.load_pem(keyfile, 'RSA PUBLIC KEY')
201 return rsa.pem.save_pem(der, 'RSA PUBLIC KEY')
218 der = rsa.pem.load_pem(keyfile, 'PUBLIC KEY')
230 from rsa.asn1 import OpenSSLPubKey
[all …]
/external/boringssl/src/crypto/x509/
Dx_all.c202 RSA *d2i_RSAPrivateKey_fp(FILE *fp, RSA **rsa) in d2i_RSAPrivateKey_fp() argument
204 return ASN1_d2i_fp_of(RSA, RSA_new, d2i_RSAPrivateKey, fp, rsa); in d2i_RSAPrivateKey_fp()
207 int i2d_RSAPrivateKey_fp(FILE *fp, RSA *rsa) in i2d_RSAPrivateKey_fp() argument
209 return ASN1_i2d_fp_of_const(RSA, i2d_RSAPrivateKey, fp, rsa); in i2d_RSAPrivateKey_fp()
212 RSA *d2i_RSAPublicKey_fp(FILE *fp, RSA **rsa) in d2i_RSAPublicKey_fp() argument
214 return ASN1_d2i_fp_of(RSA, RSA_new, d2i_RSAPublicKey, fp, rsa); in d2i_RSAPublicKey_fp()
217 RSA *d2i_RSA_PUBKEY_fp(FILE *fp, RSA **rsa) in d2i_RSA_PUBKEY_fp() argument
221 (void **)rsa); in d2i_RSA_PUBKEY_fp()
224 int i2d_RSAPublicKey_fp(FILE *fp, RSA *rsa) in i2d_RSAPublicKey_fp() argument
226 return ASN1_i2d_fp_of_const(RSA, i2d_RSAPublicKey, fp, rsa); in i2d_RSAPublicKey_fp()
[all …]
/external/boringssl/src/decrepit/rsa/
Drsa_decrepit.c69 RSA *rsa = RSA_new(); in RSA_generate_key() local
72 if (rsa == NULL || in RSA_generate_key()
75 !RSA_generate_key_ex(rsa, bits, e, NULL)) { in RSA_generate_key()
80 return rsa; in RSA_generate_key()
84 RSA_free(rsa); in RSA_generate_key()
/external/boringssl/src/crypto/pem/
Dpem_all.c121 static RSA *pkey_get_rsa(EVP_PKEY *key, RSA **rsa);
142 static RSA *pkey_get_rsa(EVP_PKEY *key, RSA **rsa) in IMPLEMENT_PEM_rw()
149 if(rsa) { in IMPLEMENT_PEM_rw()
150 RSA_free(*rsa); in IMPLEMENT_PEM_rw()
151 *rsa = rtmp; in IMPLEMENT_PEM_rw()
156 RSA *PEM_read_bio_RSAPrivateKey(BIO *bp, RSA **rsa, pem_password_cb *cb, in PEM_read_bio_RSAPrivateKey() argument
161 return pkey_get_rsa(pktmp, rsa); in PEM_read_bio_RSAPrivateKey()
166 RSA *PEM_read_RSAPrivateKey(FILE *fp, RSA **rsa, pem_password_cb *cb, in PEM_read_RSAPrivateKey() argument
171 return pkey_get_rsa(pktmp, rsa); in PEM_read_RSAPrivateKey()
/external/chromium-trace/catapult/third_party/gsutil/third_party/rsa/
DREADME.rst11 http://stuvel.eu/rsa
15 pip install rsa
19 easy_install rsa
27 .. _`Python-RSA`: http://stuvel.eu/rsa
28 .. _`Mercurial repository`: https://bitbucket.org/sybren/python-rsa
29 .. _`Python Package Index`: http://pypi.python.org/pypi/rsa

1234567