rsa

Signing a string with RSA private key on .NET?

byte[] plaintext = System.Text.Encoding.UTF8.GetBytes("AAAAAAAAAAAAA"); TextReader trCer = new StreamReader(@"AA.key"); //key in PEM format PemReader rdCer = new PemReader(trCer); AsymmetricCipherKeyPair o = rdCer.ReadObject() as AsymmetricCipherKeyPair; ISigner sig = SignerUtilities.GetSigner("MD5WithRSAEncryption"); sig.Init(true,...

JAVA - How to store and read an RSA public key from an sqlite db

Hi, i have to store a public key and a private one into a sqlite database. Actually i write the pubKey.getEncoded() into the database, and to recreate the pubkey i use the following code: ResultSet result = stat.executeQuery("select publickey from cert where id='1'"); KeyFactory rsaKeyFac = KeyFactory.getInstance("RSA"); X...

assigning / validation of signature using RSA (PKCS 7)

Any suggestions for simple and fast library for assigning / validation of signature using RSA Cryptographic Messaging Operations (PKCS#7)? ...

ObjectDisposedException when using extension method on RSAKeyValue

I was trying to write the following simple extension method for RSAKeyValue: public static class RSAKeyValueExtensions { public static string ToXmlString(this RSAKeyValue keyValue) { return keyValue.GetXml().OuterXml; } } However, it seems whenever I use ToXmlString, I get an exception: System.ObjectDisposedExc...

Using AsymmetricAlgorithm Private and Public key with RSA C#

I have two AsymmetricAlgorithm objects that contain an RSA Private and RSA Public key. The private key was retrieved out of the Windows-MY keystore and the Public key from a user's certificate. How can I use these keys along with RSACryptoServiceProvider to encrypt data using the RSA algorithm in C#? In other words, how can I specify tha...

_fopen$UNIX2003 referenced from OpenSSL problem

Hi, I'm using compiled openssl for an iphone app, I followed instruccions here http://www.x2on.de/kontakt/ so I could develop rsa operation on iphone simulator. the problem is that I get this error when building the proyect _fopen$UNIX2003 referenced from _BIO_new_file in libcrypto_i386.a(bss_file.o) _file_ctrl in libcrypto_...

For RSA, how do i calculate the secret exponent?

For RSA, how do i calculate the secret exponent? Given p and q the two primes, and phi=(p-1)(q-1), and the public exponent (0x10001), how do i get the secret exponent 'd' ? I've read that i have to do: d = e-1 mod phi using modular inversion and the euclidean equation but i cannot understand how the above formula maps to either the a-1...

How to Load RSA Private Key From File

I am working on a test harness for a SAML 1.1 Assertion Consumer Service. The test must generate a signed SAMLResponse and submit it to the ACS encoded in Base64. The ACS must be able to verify the signed message using the X509 public cert. I am able to build the SAMLResponse, adding the necessary assertions, etc. But when I try to s...

RSACryptoProvider generates same key repeatedly for same CspParameter ContainerName

I'm new to the .NET CryptoProvider space, and am a little concerned by what I have seen regarding the repeated creation of the same key by the RSACryptoProvider. I am using a container because I am storing the key off to file on the server, like so (I export the CspBlob subsequent to this creation and reimport it later)... _cp = new Csp...

Convert RSA XML to openSSH Format?

I've used the .Net class RSACryptoServiceProvider to get a keypair: using (RSACryptoServiceProvider rsa = new RSACryptoServiceProvider()) { File.WriteAllText ("PublicKeyOnly.xml", rsa.ToXmlString (false)); File.WriteAllText ("PublicPrivate.xml", rsa.ToXmlString (true)); } Now, I would like to use this with openSSH, but the key for...

iPhone SDK 4.0: Get publicKey and privateKey from a certificate / identity profile stored in KeyChain

Hello Community I am trying to get the public and private Key from a certificate which i have already installed on the iPhone. (It is shown unter Settings -> General -> Profiles) I need this keys for encryption sensitive data. (RSA Algorithm) Up to now i have found no way to get access to the keys. Is it even possible ? If not: What...

High performance RSA implementation for C# or C

Hi! I have an webservice that performs many RSA-signature operations. I use the CryptograhyProvider from .net. This uses the unmanaged CyptoAPI from Windows. I often have this error: System.Security.Cryptography.CryptographicException: Der RPC-Server ist für diesen Vorgang zu stark ausgelastet. [=The rpc server is too busy to complet...

serializing an RSAKeyValue property in Serializable class

I have a class in my C# project marked with the [Serializable] attribute. It has a property of type RSAKeyValue: [XmlElement(PUBLIC_KEY_TAG_NAME)] public RSAKeyValue Key { get; private set; } When I try to serialize an instance of my class to XML and then deserialize that XML back to an instance of my class, I get: System.Invalid...

Tiny asymmetric cipher implementation to validate download

To allow a small C++ application to update itself at clients connected over the internet, I am in need of a mechanism that validates the download based on a public key. Algorithms such as DSA or RSA seem to be able to do this nicely. However, looking at well-known available libraries for this (Crypto++, LibTomCrypt) they all end up maki...

Implementing RSA in python

Hi All, i am trying to implement RSA in python(i am new to python) for my course, the problem i have is the code i have written does not work for numbers with more than 4 digits. any idea why this is happening? please advice p =0 q=0 n=0#modules phyPQ = 0 e = 0 #public key exponent d = 0#private key exponent c = '' m = '' def getPrimes...

RSA PKCS#1 compliant signature

I am using PKCS#1 2.0 (OAEP) standard (signature with appendix), but there are some issues not clear to me. What is the physical object that is beeing signed? I know it's hash function value and so on (I do know the algorithm), but is it calculated from the binary fform of the file, no matter what is the content? What is the physical r...

RSA private key encryption

Is there any way to perform private key encryption in C#? I know about the standard RSACryptoServiceProvider in System.Security.Cryptography, but these classes provide only public key encryption and private key decryption. Also, they provide digital signature functionality, which uses internally private key encryption, but there are not...

RSA encryption or ms access Database file in c#

i hav a pbm i wanna encrypt mdb file using RSA i did but ven i do decryption and open decrypted database file it asks me for a database password .why? my ms access has no password before encryption plz help.................am using C# language. 2008 vs and ms access 2006 ...

How to calculate the Modular Multiplicative inverse of a number in the context of RSA encryption?

How to calculate the Modular Multiplicative inverse of a number in the context of RSA encryption? ...

How can I create a Crypt::RSA object from modulus, exponent, and private exponent?

I'm trying to port the following php functionality over to perl: public function loadKey($mod, $exp, $type = 'public') { $rsa = new Crypt_RSA(); $rsa->signatureMode = CRYPT_RSA_SIGNATURE_PKCS1; $rsa->setHash('sha256'); $rsa->modulus = new Math_BigInteger(Magicsig::base64_url_decode($mod), 256); $rsa->k = strlen($rsa-...