public-key

Java compact representation of ECC PublicKey

爱⌒轻易说出口 提交于 2019-12-19 03:33:03
问题 java.security.PublicKey#getEncoded() returns X509 representation of key which in case of ECC adds a lot of overhead compared to raw ECC values. I'd like to be able to convert PublicKey to byte array (and vice versa) in most compact representation (i.e. as small byte chunk as possible). KeyType (ECC) and concrete curve type are known in advance so information about them do not need to be encoded. Solution can use Java API, BouncyCastle or any other custom code/library (as long as license does

Java compact representation of ECC PublicKey

China☆狼群 提交于 2019-12-19 03:32:12
问题 java.security.PublicKey#getEncoded() returns X509 representation of key which in case of ECC adds a lot of overhead compared to raw ECC values. I'd like to be able to convert PublicKey to byte array (and vice versa) in most compact representation (i.e. as small byte chunk as possible). KeyType (ECC) and concrete curve type are known in advance so information about them do not need to be encoded. Solution can use Java API, BouncyCastle or any other custom code/library (as long as license does

Why does git sign with GPG keys rather than using SSH keys?

房东的猫 提交于 2019-12-19 00:57:09
问题 What are the differences between SSH and GPG asymmetric keys and why does git support signing with GPG rather than using the SSH agent? 回答1: The very first notion of signing anything in Git was referenced in commit ec4465a, Git v0.99, Apr. 2005 (pretty much from the very beginning) /** * A signature file has a very simple fixed format: three lines * of "object <sha1>" + "type <typename>" + "tag <tagname>", * followed by some free-form signature that git itself doesn't * care about, but that

Can you help me get my head around openssl public key encryption with rsa.h in c++?

≯℡__Kan透↙ 提交于 2019-12-18 15:33:09
问题 I am trying to get my head around public key encryption using the openssl implementation of rsa in C++. Can you help? So far these are my thoughts (please do correct if necessary) Alice is connected to Bob over a network Alice and Bob want secure communications Alice generates a public / private key pair and sends public key to Bob Bob receives public key and encrypts a randomly generated symmetric cypher key (e.g. blowfish) with the public key and sends the result to Alice Alice decrypts the

Given a Java ssh-rsa PublicKey, how can I build an SSH2 public key?

北战南征 提交于 2019-12-18 12:38:17
问题 I'm doing publicKey.getEncoded(), then appending "ssh-rsa" to the front, then base64 encoding it. Then I add the SSH2 header/footer. But it won't decode... 回答1: Java public keys are encoded as a standard X.509 SubjectPublicKeyInfo structure. SSH2 uses its own simple format. Base-64 encode the result of the encode method shown below, and affix the necessary SSH2 header and footer. public static byte[] encode(RSAPublicKey key) throws IOException { ByteArrayOutputStream buf = new

Reading PEM RSA Public Key Only using Bouncy Castle

狂风中的少年 提交于 2019-12-18 10:45:03
问题 I am trying to use C# to read in a .pem file that contains only a RSA public key. I do not have access to the private key information, nor does my application require it. The file myprivatekey.pem file begins with -----BEGIN PUBLIC KEY----- and ends with -----END PUBLIC KEY----- . My current code is as follows: Org.BouncyCastle.Crypto.AsymmetricCipherKeyPair keyPair; using (var reader = File.OpenText(@"c:\keys\myprivatekey.pem")) keyPair = (Org.BouncyCastle.Crypto.AsymmetricCipherKeyPair)new

What is the public URL for the Github public keys

自古美人都是妖i 提交于 2019-12-18 10:22:58
问题 I heard that there was a public URL for all users on github where you can access their public keys or they can supply that URL of all their public keys. Is this true? If so what is that URL. Does it exist for bitbucket as well? 回答1: You can get with: curl https://github.com/<username>.keys Replace <username> with the actual username of the GitHub user. This is useful when you set login permission to other servers. Just save its output into ~/.ssh/authorized_keys . To append it to the end from

c# RSA extract public key from private key

不羁岁月 提交于 2019-12-18 09:00:26
问题 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? 回答1: 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

Generate ECPublicKey from ECPrivateKey

别等时光非礼了梦想. 提交于 2019-12-18 07:07:27
问题 I'm trying to generate a public key given a private key and known curve. Below is my code: // Generate Keys ECGenParameterSpec ecGenSpec = new ECGenParameterSpec("secp256r1"); KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("ECDSA", "BC"); keyPairGenerator.initialize(ecGenSpec, new SecureRandom()); java.security.KeyPair pair = keyPairGenerator.generateKeyPair(); ECPrivateKey privateKey = (ECPrivateKey) pair.getPrivate(); ECPublicKey publicKeyExpected = (ECPublicKey) pair

RSA Encryption Javascript

僤鯓⒐⒋嵵緔 提交于 2019-12-17 18:47:26
问题 can anyone please help me with this, i have been instructed to write an application that takes some DATA then Encrypts it with a RSA Public Key and apparently needs to be RSA Encryption(i have never heard or seen this before)? Which encryption cipher is RSA meant to use as standard? var key =