public-key

Erlang - Importing GPG Public Key

最后都变了- 提交于 2019-12-01 07:34:38
问题 I'm trying to do some public-key-related things in Erlang, and they require me to track public keys. According to this page, I should be able to import PEM format keys by using file:read_file/1 and public_key:decode_pem/1 . The thing is, when I try to import a GPG public key, I don't get a result. I've got a file called inaimathi.pubkey with the following content: -----BEGIN PGP PUBLIC KEY BLOCK----- Version: GnuPG v1.4.11 (GNU/Linux)

Quite special PublicKey in .NET core assemblies

不打扰是莪最后的温柔 提交于 2019-12-01 03:42:54
I've noticed that core .NET assemblies have PublicKey = 00000000000000000400000000000000. Not only it's shorter then those sn.exe allows to generate (min 384 bits) but also it has a lot of zeros. How to generate signing key with such a fancy public key? That's the ECMA Standard defined public key. It's to deal with three conflicting requirements: A mechanism that ensures that assemblies are signed by their creators and could not have been created by a fraudulent other party. That CLI be defined openly in such a way that other people are free to implement a version (Mono would be a real-life

Get public key from private in Java

风流意气都作罢 提交于 2019-12-01 02:51:10
I remember do this long time ago with OpenSSL, but I want to know if it's possible and how, I've never used Cryptography on java. You cannot generate either key directly from the other. It is mathematically impossible. If you had a key blob that contained both the public and private keys, you could extract either one of them with relative ease. EDIT, 2017: Many years and a much better understanding of crypto later, and it's now clear to me that this answer isn't really correct. To quote Wikipedia: The public key consists of the modulus n and the public (or encryption) exponent e. The private

JSch how to use with PuTTY private key

扶醉桌前 提交于 2019-12-01 01:04:38
I'm trying to use JSch with a private key configuration. I've generated a public and private key using PuTTYgen but am unsure what to do with both of the files. Which key (public/private) needs transferring to the server? First, you need to register your PuTTYgen-generated public key on the server. See Getting ready for public key authentication or (my) Set up SSH public key authentication . And finally see Can we use JSch for SSH key-based communication? for details on using the private key in JSch. Make sure you use the latest version of JSch, as older versions do not support the .ppk format

Convert a X509 Public key to RSA public key

依然范特西╮ 提交于 2019-12-01 00:23:41
I have a public key in the following format -----BEGIN PUBLIC KEY----- xxxxxxxx -----END PUBLIC KEY----- I need to convert this into the following format -----BEGIN RSA PUBLIC KEY----- xxxxxxxxx -----END RSA PUBLIC KEY----- Basically, the issue is that I am working with a third party library which is written in Java. The third party library uses Java class "RSAPublicKeySpec" to generate an instance of type RSAPublicKey from a String. The String that I am supplying to this third party library is taken from a file which is in the following format: -----BEGIN PUBLIC KEY----- xxxxxxxx -----END

Get public key from private in Java

浪尽此生 提交于 2019-11-30 22:38:35
问题 I remember do this long time ago with OpenSSL, but I want to know if it's possible and how, I've never used Cryptography on java. 回答1: You cannot generate either key directly from the other. It is mathematically impossible. If you had a key blob that contained both the public and private keys, you could extract either one of them with relative ease. EDIT, 2017: Many years and a much better understanding of crypto later, and it's now clear to me that this answer isn't really correct. To quote

SSHJ Example of Public Key Auth from File

ぃ、小莉子 提交于 2019-11-30 20:46:57
Can someone give me an example of using SSHJ for Public Key Authentication? I realise this question is essentially identical to ssh example of private/public key authentication , however the answer by the author https://stackoverflow.com/users/126346/shikhar refers to a google user group that no longer exists, and I am having trouble getting it to work. Thanks! Phil Hiery Nomus We built the overthere framework on top of SSHJ. Which can connect also connect using key files. The following piece of code should work, but make sure you add the bouncycastle library to your classpath. SSHClient

How do I read the public key from a signed C# exe

我只是一个虾纸丫 提交于 2019-11-30 20:14:39
I'm signing a dot net exe using signcode.exe with an spc/pvk combo The file needs to read its own Public Key at runtime in order to verify some data. I've gone down a number of different avenues. I've tried X509Certificate executingCert = X509Certificate.CreateFromSignedFile(exe); executingCert is then null. I'm guessing signcode isn't creating an X509 signed file, though if there's a switch to change that I'm happy to go that way. edited Turns out the above does work.... I had my null check backwards (!= != ==) :) Assembly asm = Assembly.GetExecutingAssembly(); string exe = asm.Location;

How to get the RSA public-key from private-key Object in Java

烈酒焚心 提交于 2019-11-30 16:32:29
How to get the related public-key object java.security.PublicKey out of a private-key Object java.security.PrivateKey in the RSA cryptosystem. Java is able to create a public key by using the modulus and exponent: RSAPublicKeySpec keySpec = new RSAPublicKeySpec(modulus, exponent); kf.generatePublic(keySpec); So we need to extract these values out of the private key: KeyFactory kf = KeyFactory.getInstance("RSA"); RSAPrivateKeySpec priv = kf.getKeySpec(privateKey, RSAPrivateKeySpec.class); The RSAPrivateKeySpec -Object now contains the modulus we need, but the exponent is not the one we need for

How to get the RSA public-key from private-key Object in Java

拟墨画扇 提交于 2019-11-30 16:18:19
问题 How to get the related public-key object java.security.PublicKey out of a private-key Object java.security.PrivateKey in the RSA cryptosystem. 回答1: Java is able to create a public key by using the modulus and exponent: RSAPublicKeySpec keySpec = new RSAPublicKeySpec(modulus, exponent); kf.generatePublic(keySpec); So we need to extract these values out of the private key: KeyFactory kf = KeyFactory.getInstance("RSA"); RSAPrivateKeySpec priv = kf.getKeySpec(privateKey, RSAPrivateKeySpec.class);