bouncycastle

SSHJ and the Maven shade plugin

纵饮孤独 提交于 2019-12-24 17:18:09
问题 Testing SSHJ in Eclipse and everything looks good. But When I use the Maven shade plugin to package SSHJ I get the following error: Exception in thread "main" net.schmizz.sshj.userauth.UserAuthException: Exhausted available authentication methods at net.schmizz.sshj.SSHClient.auth(SSHClient.java:217) at net.schmizz.sshj.SSHClient.authPublickey(SSHClient.java:316) at net.schmizz.sshj.SSHClient.authPublickey(SSHClient.java:365) at net.schmizz.sshj.SSHClient.authPublickey(SSHClient.java:295) at

CAdES Digital Signature

烈酒焚心 提交于 2019-12-24 15:20:16
问题 I've been trying to implement digital signing (CAdES) for PDF files using Portuguese Citizen Card, however I'm having a hard time figuring out the perfectly working solution. Currently I have two sets of code. First one: public void signCAdES(...) { String pkcs11Config = "name=GemPC" + "\n" + "library=C:\\WINDOWS\\SysWOW64\\pteidpkcs11.dll"; ByteArrayInputStream configStream = new ByteArrayInputStream(pkcs11Config.getBytes()); Provider pkcs11Provider = new sun.security.pkcs11.SunPKCS11

Flush PGP Encrypted Bouncy Castle OutputStream in Java

天涯浪子 提交于 2019-12-24 10:29:49
问题 I'm working on a proof of concept Java application that reads a series of newline-separated requests from a PGP-encrypted file, processes those requests, and then writes the responses to another PGP-encrypted file, with a flush after each response write. I've successfully integrated Bouncy Castle 1.5 with my application with the exception that I cannot seem to flush the output on command: private ArmoredOutputStream armoredOut = null; private OutputStream compressedOut = null; private

no such algorithm: ECDSA for provider BC

回眸只為那壹抹淺笑 提交于 2019-12-24 09:27:48
问题 My app is minSDK 15 - so I thought I can use BouncyCastle directly. Unfortunately I get a NoSuchAlgorithmException. Do I have to use SpongyCastle then? The lib works great in a JVM app - but fails on android. Caused by: java.security.NoSuchAlgorithmException: no such algorithm: ECDSA for provider BC at sun.security.jca.GetInstance.getService(GetInstance.java:87) at sun.security.jca.GetInstance.getInstance(GetInstance.java:206) at java.security.KeyPairGenerator.getInstance(KeyPairGenerator

Why doesn't Google Cloud Key Management Service's Java client library support Android?

折月煮酒 提交于 2019-12-24 09:04:09
问题 It is documented as not supporting Android. Why? Is it just because Android's BouncyCastle 's implementation is shrunk down on features and doesn't support things like KeyPairGenerator/ECDSA (Elliptic Curve Digital Signature Algorithm)? (Here's another link on that.) Wouldn't it be enough to just use SpongyCastle instead? Is it just because Google doesn't support SpongyCastle that its KMS Java client doesn't support Android? 回答1: https://github.com/GoogleCloudPlatform/google-cloud-java/issues

Using DEROctetString vs pure Extension

末鹿安然 提交于 2019-12-24 08:35:35
问题 I am using bouncy castle librarires to add extensions to my X509V3Certificate certificate.Let's say that I want to add ExtendedKeyUsage extension to my certificate.I am using X509V3CertificateBuilder class and addExtension() method so I do this. X509V3CertificateBuilder cf=...; ExtendedKeyUsage eku = new ExtendedKeyUsage(KeyPurposeId.anyExtendedKeyUsage); cf.addExtension(Extension.ExtendedKeyUsage, false , eku); But what I am seeing in some examples all over the web , people are doing next

.net core PGP Encryption Decryption

廉价感情. 提交于 2019-12-24 07:49:03
问题 Running into error on the void Encryption(). public void Encryption() { #region PGP Encryption PgpEncryptionKeys encryptionKeys = new PgpEncryptionKeys(@"C:\Keys\PGPPublicKey.asc", @"C:\Keys\PGPPrivateKey.asc", "password"); PgpEncrypt encrypter = new PgpEncrypt(encryptionKeys); using (Stream outputStream = File.Create("C:\\Keys\\EncryptData.txt")) { encrypter.EncryptAndSign(outputStream, new FileInfo(@"D:\Keys\PlainText.txt")); } Console.WriteLine("Encryption Done !"); #endregion } I used

S/MIME verification with x509 certificate

妖精的绣舞 提交于 2019-12-24 07:08:08
问题 I have some problems with verifying S/Mime signed message with x509 certificate. This is my code: public class verifyMsg { private static void verify(SMIMESignedParser s) throws Exception { Security.addProvider(new BouncyCastleProvider()); System.out.println("wbilem"); CertStore certs = s.getCertificatesAndCRLs("Collection", "BC"); SignerInformationStore signers = s.getSignerInfos(); Collection c = signers.getSigners(); Iterator it = c.iterator(); while (it.hasNext()) { File f = new File(

unable to verify string signed by openssl with dsa key

僤鯓⒐⒋嵵緔 提交于 2019-12-24 06:23:06
问题 Adapting the directions at Creating a DSA Signature from the Linux command line I created a DSA signed message: echo "foobar" > foo.txt openssl dgst -dss1 -sign dsa_priv.pem foo.txt > sigfile.bin The directions actually used foo.sha1 instead of foo.txt, where foo.sha1 was generated by sha1sum but signing a hash seems a bit redundant since DSA is, itself, supposed to do hashing. So, anyway, I did that. Here's the private key I used (I generated it specifically for testing purposes): -----BEGIN

Convert java.security “NONEwithRSA” signature into BouncyCastle lightweight API

ⅰ亾dé卋堺 提交于 2019-12-24 02:31:44
问题 I need to convert Java app into C# and therefore need to migrate from java.security API into BouncyCastle lightweight API. My working code (java.security) looks like this: private byte[] computeSignature(byte[] message, PrivateKey key) { Signature signature = Signature.getInstance("NONEwithRSA"); signature.initSign(privateKey); signature.update(message); return signature.sign(); } This is my verification: private void verifySignature(byte[] signature, byte[] message, PublicKey publicKey) {