bouncycastle

Create CRL file with Bouncy Castle c#

无人久伴 提交于 2019-12-12 20:55:19
问题 I've build my own root CA certificate with Bouncy Castle, and I'm using it to build other certificates. I want to build a Certificate Revocation List (CRL) to include the list of revoqued certificates, using Bouncy Castle C#. Example: //Retrieve CA root certificate X509Store CAstore = new X509Store(StoreName.Root, StoreLocation.CurrentUser); CAstore.Open(OpenFlags.ReadWrite | OpenFlags.OpenExistingOnly); X509Certificate2Collection x509Certificate2Collection = CAstore.Certificates.Find

Is BouncyCastle's SecureRandom in C# threadsafe?

陌路散爱 提交于 2019-12-12 16:26:49
问题 The answer is apparently yes for the implementation in Java, but how about Org.BouncyCastle.Security.SecureRandom in C#? 回答1: Since, as far as I know, there is no official (or even any) documentation of C# Bouncy Castle port - all we can do is look at source code and try to draw some conclusions. Here is source code of SecureRandom. We can see that the main methods there are NextCounterValue (used to generate seeds) and NextBytes used to generate actual random data. NextCounterValue is thread

How to convert BouncyCastle X509Certificate to .NET Standard X509Certificate2 while retaining the private key?

落爺英雄遲暮 提交于 2019-12-12 14:19:12
问题 I need to convert a generated BouncyCastle X509Certificate to X509Certificate2 with the private key getting loaded in the resulting .NET Standard X509Certificate2 object. Is that possible? There is an answer for a similar question https://stackoverflow.com/a/8150799/5048935 , but after generating a BouncyCastle certificate and converting it to .NET X509Certificate2 the resulting object has its HasPrivateKey property set to "false". Context I need to load a certificate and a private key

Export EC private key from BouncyCastle and import into CngKey or ECDsaCng?

落花浮王杯 提交于 2019-12-12 10:10:34
问题 I have created key pairs for elliptic curve DSA signatures using BouncyCastle and managed to import the public key into ECDsaCng using an XMLString accoding to RFC4050. Now I want to also move the private key and have not managed to find a solution. The closest I have got is using CngKey.Import. CngKey.Import supports PKCS#8 format so if you can get your keys into valid pkcs8 then it should work. Unfortunately the following code does not quite work. var privatekey = (ECPrivateKeyParameters)

How to sign a .jar file using XMSS (PQC) Signature Scheme with JarSigner

南笙酒味 提交于 2019-12-12 09:56:40
问题 I am trying to use JarSigner to sign .jar files with XMSS Signatures. With the use of the JCA/JCE Post-Quantum Cryptography Provider from BouncyCastle it is possible to generate XMSS and XMSSMT KeyPairs programmatically (example). In order to use JarSigner it is, as far as I know, crucial to provide a KeyStore and the alias of the entry one wants to sign its code with: jarsigner -keystore myKeystore -storetype JKS -storepass password -keypass password myjarfile.jar keystoreEntryAlias The

CMS Signature - What is the difference Time Stamp & Counter Signature

徘徊边缘 提交于 2019-12-12 09:53:45
问题 I am trying to TimeStamp a Digital Siganture (with a local TimeStamp certificate) in C# with BouncyCastle. My understanding about TimeStamp is that it is to sign the current time. Not sure if it should be current time + original signature content? Please help on this also. My main confusion is if the generated TimeStamp be added to Singed/Unsigned attributes of original signature. OR it will be added as a CounterSignature? 回答1: Time stamp's goal is to prove that signature was created before a

PBEWITHSHA256AND128BITAES-CBC-BC creating java.security.NoSuchAlgorithmException on RedHat 6.4

给你一囗甜甜゛ 提交于 2019-12-12 09:36:50
问题 We have an application that uses Bouncy Castle to encrypt data using PBEWITHSHA256AND128BITAES-CBC-BC algorithm. It works fine on Ubuntu running OpenJDK 1.7 . But when when we move it to RedHat 6.4 also running OpenJDK 1.7 , we get the following exception: java.security.NoSuchAlgorithmException Any thoughts on what could be causing this. How can we add PBEWITHSHA256AND128BITAES-CBC-BC algorithm to RedHat 6.4 ? p.s. the application is running in JBoss . private String cryptoAlgorithm =

IllegalAccessError with Android and BouncyCastle

谁说胖子不能爱 提交于 2019-12-12 09:01:24
问题 I am trying to implement a timestamp request as seen here: http://bouncy-castle.1462172.n4.nabble.com/Timestamp-request-and-response-td1558231.html In j2se it works fine, but on android I get an IllegalAccessError. Logcat output : FATAL EXCEPTION: main java.lang.IllegalAccessError: tried to access method org.bouncycastle.asn1.DERBoolean.<init>:(Z)V from class org.bouncycastle.tsp.TimeStampRequestGenerator at org.bouncycastle.tsp.TimeStampRequestGenerator.setCertReq(Unknown Source) at org.ats

Java BouncyCastle Cast6Engine (CAST-256) encrypting

≯℡__Kan透↙ 提交于 2019-12-12 08:17:13
问题 I'm trying to implement a function that receives a string and returns the encoded values of the String in CAST-256. The following code is what i implement following the example on BoncyCastle official web page (http://www.bouncycastle.org/specifications.html , point 4.1). import org.bouncycastle.crypto.BufferedBlockCipher; import org.bouncycastle.crypto.CryptoException; import org.bouncycastle.crypto.engines.CAST6Engine; import org.bouncycastle.crypto.paddings.PaddedBufferedBlockCipher;

BouncyCastle in-memory PGP encryption in C#

匆匆过客 提交于 2019-12-12 07:56:36
问题 I've been trying to use the BouncyCastle library to do PGP encryption/decryption. I have some code that I need to modify to use streams only - no files. I tried removing the PgpUtilities.WriteFileToLiteralData() and then making it return a stream, but it didn't work (output stream was empty). To be more clear here is what the method should be: public static Stream EncryptFile(MemoryStream inputStream, PgpPublicKey encKey, bool withIntegrityCheck) Here is the code I need to modify: private