Home
last modified time | relevance | path

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

12345678910>>...13

/external/boringssl/src/crypto/fipsmodule/rsa/
Drsa_impl.c75 static int check_modulus_and_exponent_sizes(const RSA *rsa) { in check_modulus_and_exponent_sizes() argument
76 unsigned rsa_bits = BN_num_bits(rsa->n); in check_modulus_and_exponent_sizes()
94 if (BN_num_bits(rsa->e) > kMaxExponentBits) { in check_modulus_and_exponent_sizes()
107 assert(BN_ucmp(rsa->n, rsa->e) > 0); in check_modulus_and_exponent_sizes()
132 static int freeze_private_key(RSA *rsa, BN_CTX *ctx) { in freeze_private_key() argument
133 CRYPTO_MUTEX_lock_read(&rsa->lock); in freeze_private_key()
134 int frozen = rsa->private_key_frozen; in freeze_private_key()
135 CRYPTO_MUTEX_unlock_read(&rsa->lock); in freeze_private_key()
141 CRYPTO_MUTEX_lock_write(&rsa->lock); in freeze_private_key()
142 if (rsa->private_key_frozen) { in freeze_private_key()
[all …]
Drsa.c88 RSA *rsa = OPENSSL_malloc(sizeof(RSA)); in RSA_new_method() local
89 if (rsa == NULL) { in RSA_new_method()
94 OPENSSL_memset(rsa, 0, sizeof(RSA)); in RSA_new_method()
97 rsa->meth = ENGINE_get_RSA_method(engine); in RSA_new_method()
100 if (rsa->meth == NULL) { in RSA_new_method()
101 rsa->meth = (RSA_METHOD *) RSA_default_method(); in RSA_new_method()
103 METHOD_ref(rsa->meth); in RSA_new_method()
105 rsa->references = 1; in RSA_new_method()
106 rsa->flags = rsa->meth->flags; in RSA_new_method()
107 CRYPTO_MUTEX_init(&rsa->lock); in RSA_new_method()
[all …]
/external/boringssl/src/crypto/rsa_extra/
Drsa_test.cc467 bssl::UniquePtr<RSA> rsa( in TEST() local
469 ASSERT_TRUE(rsa); in TEST()
471 EXPECT_TRUE(RSA_check_key(rsa.get())); in TEST()
476 rsa.get(), &out_len, out, sizeof(out), kTwoPrimeEncryptedMessage, in TEST()
482 bssl::UniquePtr<RSA> rsa( in TEST() local
484 ASSERT_TRUE(rsa); in TEST()
485 EXPECT_TRUE(RSA_check_fips(rsa.get())); in TEST()
495 bssl::UniquePtr<RSA> rsa(RSA_new()); in TEST() local
496 ASSERT_TRUE(rsa); in TEST()
499 EXPECT_FALSE(RSA_generate_key_fips(rsa.get(), 512, nullptr)); in TEST()
[all …]
Drsa_asn1.c127 int RSA_marshal_public_key(CBB *cbb, const RSA *rsa) { in RSA_marshal_public_key() argument
130 !marshal_integer(&child, rsa->n) || in RSA_marshal_public_key()
131 !marshal_integer(&child, rsa->e) || in RSA_marshal_public_key()
140 const RSA *rsa) { in RSA_public_key_to_bytes() argument
144 !RSA_marshal_public_key(&cbb, rsa) || in RSA_public_key_to_bytes()
216 int RSA_marshal_private_key(CBB *cbb, const RSA *rsa) { in RSA_marshal_private_key() argument
220 !marshal_integer(&child, rsa->n) || in RSA_marshal_private_key()
221 !marshal_integer(&child, rsa->e) || in RSA_marshal_private_key()
222 !marshal_integer(&child, rsa->d) || in RSA_marshal_private_key()
223 !marshal_integer(&child, rsa->p) || in RSA_marshal_private_key()
[all …]
/external/python/rsa/tests/
Dtest_prime.py21 from rsa._compat import range
22 import rsa.prime
23 import rsa.randnum
31 self.assertFalse(rsa.prime.is_prime(-1))
32 self.assertFalse(rsa.prime.is_prime(0))
33 self.assertFalse(rsa.prime.is_prime(1))
34 self.assertTrue(rsa.prime.is_prime(2))
35 self.assertFalse(rsa.prime.is_prime(42))
36 self.assertTrue(rsa.prime.is_prime(41))
41 [x for x in range(901, 1000) if rsa.prime.is_prime(x)]
[all …]
Dtest_cli.py15 import rsa
16 import rsa.cli
17 import rsa.util
18 from rsa._compat import PY2
95 cls.pub_key, cls.priv_key = rsa.newkeys(512)
127 self.assertExits(1, rsa.cli.keygen)
132 rsa.cli.keygen()
145 rsa.cli.keygen()
155 rsa.PrivateKey.load_pkcs1(pemfile.read())
161 rsa.cli.keygen()
[all …]
Dtest_load_save_keys.py26 from rsa._compat import range
27 import rsa.key
82 key = rsa.key.PrivateKey.load_pkcs1(PRIVATE_DER, 'DER')
83 expected = rsa.key.PrivateKey(3727264081, 65537, 3349121513, 65063, 57287)
106 key = rsa.key.PrivateKey.load_pkcs1(PRIVATE_DER, 'DER')
123 key = rsa.key.PrivateKey(3727264081, 65537, 3349121513, 65063, 57287)
132 key = rsa.key.PublicKey.load_pkcs1(PUBLIC_DER, 'DER')
133 expected = rsa.key.PublicKey(3727264081, 65537)
140 key = rsa.key.PublicKey(3727264081, 65537)
153 key = rsa.key.PrivateKey.load_pkcs1(PRIVATE_PEM, 'PEM')
[all …]
Dtest_parallel.py5 import rsa.prime
6 import rsa.parallel
7 import rsa.common
14 p = rsa.parallel.getprime(1024, 3)
16 self.assertFalse(rsa.prime.is_prime(p - 1))
17 self.assertTrue(rsa.prime.is_prime(p))
18 self.assertFalse(rsa.prime.is_prime(p + 1))
20 self.assertEqual(1024, rsa.common.bit_size(p))
Dtest_pem.py20 from rsa._compat import is_bytes
21 from rsa.pem import _markers
22 import rsa.key
60 key = rsa.key.PublicKey.load_pkcs1_openssl_pem(public_key_pem)
64 key = rsa.key.PublicKey.load_pkcs1_openssl_pem(public_key_pem.encode('ascii'))
68 key = rsa.key.PrivateKey.load_pkcs1(private_key_pem)
72 key = rsa.key.PrivateKey.load_pkcs1(private_key_pem.encode('ascii'))
81 key = rsa.key.PublicKey.load_pkcs1_openssl_pem(public_key_pem)
86 key = rsa.key.PrivateKey.load_pkcs1(private_key_pem)
95 key = rsa.key.PublicKey.load_pkcs1_openssl_pem(public_key_pem.encode('ascii'))
[all …]
Dtest_key.py7 import rsa.key
8 import rsa.core
19 pk = rsa.key.PrivateKey(3727264081, 65537, 3349121513, 65063, 57287)
22 encrypted = rsa.core.encrypt_int(message, pk.e, pk.n)
25 decrypted = rsa.core.decrypt_int(blinded, pk.d, pk.n)
33 priv, pub = rsa.key.newkeys(16, exponent=3)
39 priv, pub = rsa.key.newkeys(16)
45 pk = rsa.key.PrivateKey(3727264081, 65537, 3349121513, 65063, 57287)
63 (p, q, e, d) = rsa.key.gen_keys(64,
75 priv, pub = rsa.key.newkeys(16)
/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 …]
/external/boringssl/src/include/openssl/
Drsa.h90 OPENSSL_EXPORT void RSA_free(RSA *rsa);
94 OPENSSL_EXPORT int RSA_up_ref(RSA *rsa);
100 OPENSSL_EXPORT unsigned RSA_bits(const RSA *rsa);
105 OPENSSL_EXPORT void RSA_get0_key(const RSA *rsa, const BIGNUM **out_n,
110 OPENSSL_EXPORT void RSA_get0_factors(const RSA *rsa, const BIGNUM **out_p,
117 OPENSSL_EXPORT void RSA_get0_crt_params(const RSA *rsa, const BIGNUM **out_dmp1,
130 OPENSSL_EXPORT int RSA_set0_key(RSA *rsa, BIGNUM *n, BIGNUM *e, BIGNUM *d);
140 OPENSSL_EXPORT int RSA_set0_factors(RSA *rsa, BIGNUM *p, BIGNUM *q);
150 OPENSSL_EXPORT int RSA_set0_crt_params(RSA *rsa, BIGNUM *dmp1, BIGNUM *dmq1,
164 OPENSSL_EXPORT int RSA_generate_key_ex(RSA *rsa, int bits, const BIGNUM *e,
[all …]
/external/openssh/regress/
Dhostkey-rotate.sh62 check_key_present ssh-rsa || fail "didn't learn keys"
74 mv $OBJ/hkr.ssh-rsa.pub $OBJ/hkr.ssh-rsa.pub.old
75 rm -f $OBJ/hkr.ssh-rsa
76 ${SSHKEYGEN} -qt ssh-rsa -f $OBJ/hkr.ssh-rsa -N '' || fatal "ssh-keygen $k"
80 check_key_present ssh-rsa $OBJ/hkr.ssh-rsa.pub.old && fail "old key present"
81 check_key_present ssh-rsa || fail "didn't learn changed key"
85 ${SSHKEYGEN} -qt ssh-rsa -f $OBJ/hkr.ssh-rsa-new -N '' || fatal "ssh-keygen $k"
86 ( cat $OBJ/sshd_proxy.orig ; echo HostKey $OBJ/hkr.ssh-rsa-new ) \
89 dossh -oStrictHostKeyChecking=yes -oHostKeyAlgorithms=ssh-rsa,$all_algs
91 check_key_present ssh-rsa || fail "current key missing"
[all …]
/external/boringssl/src/crypto/evp/
Dp_rsa_asn1.c79 !RSA_marshal_public_key(&key_bitstring, key->pkey.rsa) || in rsa_pub_encode()
100 RSA *rsa = RSA_parse_public_key(key); in rsa_pub_decode() local
101 if (rsa == NULL || CBS_len(key) != 0) { in rsa_pub_decode()
103 RSA_free(rsa); in rsa_pub_decode()
107 EVP_PKEY_assign_RSA(out, rsa); in rsa_pub_decode()
112 return BN_cmp(b->pkey.rsa->n, a->pkey.rsa->n) == 0 && in rsa_pub_cmp()
113 BN_cmp(b->pkey.rsa->e, a->pkey.rsa->e) == 0; in rsa_pub_cmp()
125 !RSA_marshal_private_key(&private_key, key->pkey.rsa) || in rsa_priv_encode()
144 RSA *rsa = RSA_parse_private_key(key); in rsa_priv_decode() local
145 if (rsa == NULL || CBS_len(key) != 0) { in rsa_priv_decode()
[all …]
Dp_rsa.c174 RSA *rsa = ctx->pkey->pkey.rsa; in pkey_rsa_sign() local
191 if (!RSA_sign(EVP_MD_type(rctx->md), tbs, tbslen, sig, &out_len, rsa)) { in pkey_rsa_sign()
198 return RSA_sign_pss_mgf1(rsa, siglen, sig, *siglen, tbs, tbslen, in pkey_rsa_sign()
206 return RSA_sign_raw(rsa, siglen, sig, *siglen, tbs, tbslen, rctx->pad_mode); in pkey_rsa_sign()
213 RSA *rsa = ctx->pkey->pkey.rsa; in pkey_rsa_verify() local
218 return RSA_verify(EVP_MD_type(rctx->md), tbs, tbslen, sig, siglen, rsa); in pkey_rsa_verify()
221 return RSA_verify_pss_mgf1(rsa, tbs, tbslen, rctx->md, rctx->mgf1md, in pkey_rsa_verify()
232 !RSA_verify_raw(rsa, &rslen, rctx->tbuf, key_len, sig, siglen, in pkey_rsa_verify()
246 RSA *rsa = ctx->pkey->pkey.rsa; in pkey_rsa_verify_recover() local
260 return RSA_verify_raw(rsa, out_len, out, *out_len, sig, sig_len, in pkey_rsa_verify_recover()
[all …]
Dprint.c136 static int do_rsa_print(BIO *out, const RSA *rsa, int off, in do_rsa_print() argument
143 update_buflen(rsa->n, &buf_len); in do_rsa_print()
144 update_buflen(rsa->e, &buf_len); in do_rsa_print()
147 update_buflen(rsa->d, &buf_len); in do_rsa_print()
148 update_buflen(rsa->p, &buf_len); in do_rsa_print()
149 update_buflen(rsa->q, &buf_len); in do_rsa_print()
150 update_buflen(rsa->dmp1, &buf_len); in do_rsa_print()
151 update_buflen(rsa->dmq1, &buf_len); in do_rsa_print()
152 update_buflen(rsa->iqmp, &buf_len); in do_rsa_print()
161 if (rsa->n != NULL) { in do_rsa_print()
[all …]
/external/python/rsa/
DREADME.md4 [![PyPI](https://img.shields.io/pypi/v/rsa.svg)](https://pypi.org/project/rsa/)
5 …https://travis-ci.org/sybrenstuvel/python-rsa.svg?branch=master)](https://travis-ci.org/sybrenstuv…
6 …io/repos/github/sybrenstuvel/python-rsa/badge.svg?branch=master)](https://coveralls.io/github/sybr…
7 …s.io/codeclimate/github/sybrenstuvel/python-rsa.svg)](https://codeclimate.com/github/sybrenstuvel/…
9 [Python-RSA](https://stuvel.eu/rsa) is a pure-Python RSA implementation. It supports
15 Documentation can be found at the [Python-RSA homepage](https://stuvel.eu/rsa).
19 pip install rsa
21 or download it from the [Python Package Index](https://pypi.org/project/rsa/).
23 The source code is maintained at [GitHub](https://github.com/sybrenstuvel/python-rsa/) and is
33 - `rsa._version133`
[all …]
DCHANGELOG.txt8 - rsa.varblock
9 - rsa.bigfile
10 - rsa._version133
11 - rsa._version200
17 [#58](https://github.com/sybrenstuvel/python-rsa/pull/58)
18 - Added function `rsa.find_signature_hash()` to return the name of the hashing
19 algorithm used to sign a message. `rsa.verify()` now also returns that name,
21 [#78](https://github.com/sybrenstuvel/python-rsa/issues/13)
23 [#104](https://github.com/sybrenstuvel/python-rsa/pull/104)
43 - Moved development to GitHub: https://github.com/sybrenstuvel/python-rsa
[all …]
/external/python/rsa/doc/
Dusage.rst30 You can use the :py:func:`rsa.newkeys` function to create a keypair:
32 >>> import rsa
33 >>> (pubkey, privkey) = rsa.newkeys(512)
35 Alternatively you can use :py:meth:`rsa.PrivateKey.load_pkcs1` and
36 :py:meth:`rsa.PublicKey.load_pkcs1` to load keys from a file:
38 >>> import rsa
41 >>> privkey = rsa.PrivateKey.load_pkcs1(keydata)
61 >>> (pubkey, privkey) = rsa.newkeys(512, poolsize=8)
97 To encrypt or decrypt a message, use :py:func:`rsa.encrypt` resp.
98 :py:func:`rsa.decrypt`. Let's say that Alice wants to send a message
[all …]
Dreference.rst10 .. autofunction:: rsa.encrypt
12 .. autofunction:: rsa.decrypt
14 .. autofunction:: rsa.sign
16 .. autofunction:: rsa.verify
18 .. autofunction:: rsa.find_signature_hash
20 .. autofunction:: rsa.newkeys(keysize)
34 .. autoclass:: rsa.PublicKey
38 .. autoclass:: rsa.PrivateKey
45 .. autoclass:: rsa.pkcs1.CryptoError(Exception)
47 .. autoclass:: rsa.pkcs1.DecryptionError(CryptoError)
[all …]
/external/openssh/
Dsshconnect1.c100 packet_put_bignum(idlist->keys[i]->rsa->n); in try_agent_authentication()
235 packet_put_bignum(public->rsa->n); in try_rsa_authentication()
321 respond_to_rsa_challenge(challenge, private->rsa); in try_rsa_authentication()
357 packet_put_int(BN_num_bits(host_key->rsa->n)); in try_rhosts_rsa_authentication()
358 packet_put_bignum(host_key->rsa->e); in try_rhosts_rsa_authentication()
359 packet_put_bignum(host_key->rsa->n); in try_rhosts_rsa_authentication()
385 respond_to_rsa_challenge(challenge, host_key->rsa); in try_rhosts_rsa_authentication()
526 packet_get_bignum(server_key->rsa->e); in ssh_kex()
527 packet_get_bignum(server_key->rsa->n); in ssh_kex()
529 rbits = BN_num_bits(server_key->rsa->n); in ssh_kex()
[all …]
/external/python/rsa/rsa/
Dkey.py39 from rsa._compat import range
40 import rsa.prime
41 import rsa.pem
42 import rsa.common
43 import rsa.randnum
44 import rsa.core
178 return (rsa.common.inverse(r, self.n) * blinded) % self.n
258 from rsa.asn1 import AsnPubKey
271 from rsa.asn1 import AsnPubKey
292 der = rsa.pem.load_pem(keyfile, 'RSA PUBLIC KEY')
[all …]
Dcli.py28 import rsa
29 import rsa.pkcs1
31 HASH_METHODS = sorted(rsa.pkcs1.HASH_METHODS.keys())
68 (pub_key, priv_key) = rsa.newkeys(keysize)
86 rsa._compat.write_to_stdout(data)
107 key_class = rsa.PublicKey
192 rsa._compat.write_to_stdout(outdata)
208 return rsa.encrypt(indata, pub_key)
220 key_class = rsa.PrivateKey
225 return rsa.decrypt(indata, priv_key)
[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()
88 int RSA_padding_add_PKCS1_PSS(const RSA *rsa, uint8_t *EM, const uint8_t *mHash, in RSA_padding_add_PKCS1_PSS() argument
90 return RSA_padding_add_PKCS1_PSS_mgf1(rsa, EM, mHash, Hash, NULL, sLen); in RSA_padding_add_PKCS1_PSS()
93 int RSA_verify_PKCS1_PSS(const RSA *rsa, const uint8_t *mHash, in RSA_verify_PKCS1_PSS() argument
95 return RSA_verify_PKCS1_PSS_mgf1(rsa, mHash, Hash, NULL, EM, sLen); in RSA_verify_PKCS1_PSS()
/external/u-boot/lib/rsa/
Drsa-sign.c60 RSA *rsa; in rsa_pem_get_pub_key() local
90 rsa = EVP_PKEY_get1_RSA(key); in rsa_pem_get_pub_key()
91 if (!rsa) { in rsa_pem_get_pub_key()
99 *rsap = rsa; in rsa_pem_get_pub_key()
127 RSA *rsa; in rsa_engine_get_pub_key() local
153 rsa = EVP_PKEY_get1_RSA(key); in rsa_engine_get_pub_key()
154 if (!rsa) { in rsa_engine_get_pub_key()
161 *rsap = rsa; in rsa_engine_get_pub_key()
199 RSA *rsa; in rsa_pem_get_priv_key() local
211 rsa = PEM_read_RSAPrivateKey(f, 0, NULL, path); in rsa_pem_get_priv_key()
[all …]

12345678910>>...13