private-key

SSH.NET Authenticate via private key only (public key authentication)

倖福魔咒の 提交于 2019-11-30 05:08:50
问题 Attempting to authenticate via username and privatekey only using the current SSH.NET library. I cannot get the password from the user so this is out of the question. here is what i am doing now. Renci.SshNet.ConnectionInfo conn = new ConnectionInfo(hostName, port, username, new AuthenticationMethod[] { new PasswordAuthenticationMethod(username, ""), new PrivateKeyAuthenticationMethod(username, new PrivateKeyFile[] { new PrivateKeyFile(privateKeyLocation, "") }), }); using (var sshClient =

Access denied when creating keystore for Android app

烂漫一生 提交于 2019-11-30 01:04:58
I am trying to sign my Android app so I can release it in Market. When I generate the keystore, I get an access denied error. How do I fix this? This is what I've been trying to do: Right click project in Eclipse Helios. Android Tools > Export Signed Application Package. Click next. I check "Create new keystore" and realize it does nothing to help me. It still asks for the location of keystore. So I decide to do it the hard way. Turned off read-only access on C:\Program Files\Java\jdk1.6.0_25\bin and granted the CREATOR OWNER group full control of the folder. Open command line on Windows 7 64

Using AsymmetricAlgorithm Private and Public key with RSA C#

馋奶兔 提交于 2019-11-29 23:20:36
问题 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 that I want to use keys that I already have? 回答1: #region "RSA Encrypt/Decrypt" public string RSAEncrypt(string str, string publicKey) { //---Creates a new

How to use public and private key encryption technique in C#

ⅰ亾dé卋堺 提交于 2019-11-29 21:43:35
I want to encrypt data using public/private key technique. I mean, encrypt with the public key of receiver and the receiver can decrypt with their own private key. How can I do that? Do you have any suggestion or sample code ? Code example: private static string _privateKey; private static string _publicKey; private static UnicodeEncoding _encoder = new UnicodeEncoding(); private static void RSA() { var rsa = new RSACryptoServiceProvider(); _privateKey = rsa.ToXmlString(true); _publicKey = rsa.ToXmlString(false); var text = "Test1"; Console.WriteLine("RSA // Text to encrypt: " + text); var enc

How to generate a RSA keyPair with a Privatekey encrypted with password?

北城以北 提交于 2019-11-29 20:01:58
I want to generate a privatekey PKCS8 format encrypted with password, and I try with this code: String password = "123456"; KeyPairGenerator gen = KeyPairGenerator.getInstance("RSA"); gen.initialize(2048); KeyPair key = gen.generateKeyPair(); PrivateKey privateKey = key.getPrivate(); PublicKey publicKey = key.getPublic(); FileOutputStream pvt = new FileOutputStream("d:\\pvt123456.der"); try { pvt.write(privateKey.getEncoded()); pvt.flush(); } finally { pvt.close(); } FileOutputStream pub = new FileOutputStream("d:\\pub123456.der"); try { pub.write(publicKey.getEncoded()); pub.flush(); }

Check that a file is certificate or a key

别说谁变了你拦得住时间么 提交于 2019-11-29 16:41:36
I have a problem, I am allowing the used to upload certificate and private key files. Now suppose I have a file whose extension is messed-up (changed knowingly or unknowingly) say to break the system.. I need to put a validation in place that can check and can tell me that the given file is a valid certificate file or private key file or some other file.. What i was thing was : to check for -- BEGIN CERTIFICATE -- , -- BEGIN RSA PRIVATE KEY -- in the file content.. Please tell what I am thing is good, or there is some other better solution to this problem.. Thanks jww check and can tell me

Android Fingerprint API and Private/Public keys

匆匆过客 提交于 2019-11-29 16:41:17
问题 When I enrol first and only fingerprint and generate KeyPair the PrivateKey gets invalidated when I use it for the second time. This happens only once. Am I the only one having this issue? Is there something wrong with my code? I cannot use any other key as I'm using PrivateKey to sign data. Steps: Wipe all fingerprints Enrol one fingerprint Generate KeyPair and use FingerprintManager :: authenticate During next use of FingerprintManager :: authenticate PrivateKey gets permanently invalidated

c# RSA extract public key from private key

╄→гoц情女王★ 提交于 2019-11-29 15:20:32
Is there a way to extract public key from private key in c#? Becouse if i do ToXMLString() then i can set if i want public key information saved with the private key. So now im thinking that is there a way to extract public key from private? The normal private key format for RSA includes the public key (the "public exponent" is useful for implementation of private key operations in a way which resists timing attacks). Therefore, it is possible to extract the public key from the private key. (It is theoretically possible to have a "pure RSA private key" which does NOT include the public

JSch to add private key from a string

有些话、适合烂在心里 提交于 2019-11-29 11:17:10
I have the contents of the key pair file for SFTP as a string. I need to use JSch to add the contents, but addIdentity only accepts a file path. Is there anyway I can do this? I see that the KeyPair class has a method - KeyPair load(JSch jsch, byte[] bytes, byte[] bytes1) I'm not sure what this does. There is an addIdentity overload that takes the key from a buffer : public class JSch { ... public void addIdentity(String name, byte[]prvkey, byte[]pubkey, byte[] passphrase) See also Java SFTP client that takes private key as a string . For an example of implementation, see JSch: addIdentity

Android Decryption Error

淺唱寂寞╮ 提交于 2019-11-29 07:58:13
问题 I am trying to encrypt and decrypt Strings in my Android application but I keep getting an InvalidKeyException error. Here is my code: //Generate Keys method public void generateKeys() { Calendar cal = Calendar.getInstance(); Date now = cal.getTime(); cal.add(Calendar.YEAR, 25); Date end = cal.getTime(); KeyPairGenerator kpg = null; try { kpg = KeyPairGenerator.getInstance("RSA", "AndroidKeyStore"); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } catch (NoSuchProviderException e