Questions tagged [der]

Distinguished Encoding Rules (DER) certificate encoding is a method of turning ASN.1 attributes and values into a machine-friendly format.

215 questions
2
votes
0 answers

How to convert STACK_OF(X509) to DER in OpenSSL 1.1.0?

While working on porting from OpenSSL 0.9.8 to 1.1.0, I have run into a missing function. The OpenSSL team has been busy cleaning up their code base, and one of the cleanups was to remove some ASN handling macros & functions. We used to be able…
user590028
  • 11,364
  • 3
  • 40
  • 57
2
votes
1 answer

Create and verify signature in code and from the command line using ECDSA

Problem: Using the written demo code (given below) I can create and verify without problems. However, using the openssl command line tool, verifying a signature (created by the demo code) always seems to fail. What I have done: The demo code creates…
0laf
  • 95
  • 1
  • 2
  • 9
2
votes
2 answers

Convert "emailAdress=" found in Subject field of x.509 SSL certificate to hexadecimal

I have a 'Subject' of SSL x.509 certificate given as Subject: C=XX, ST=XX, L=XX, O=XX, OU=XX, emailAddress=admin@adobe.pw, CN=trustasia.asia and I want to covert this to binary stream as found in SSL certificate when it is sent on wire, I know…
2
votes
2 answers

ASN1/ DER grammar for RSA key

I am looking for ASN1 grammar file for DER ASN1 encoding of RSA keys I am looking for grammar file so that i can compile it using ASN1C compiler and subsequently write my own 'c' code using GMP to extract public key out of a given RSA key file. It…
2
votes
0 answers

Reading from DER File Forge JS in the Browser

I'm trying to read binary encoded DER files (which could be password encrypted or not) in the browser using Forge.JS https://github.com/digitalbazaar/forge I read in the file this way var selectedFile = event.target.files[0]; var reader = new…
Gakho
  • 603
  • 1
  • 9
  • 18
2
votes
1 answer

Signing a string with RSA private key on .NET?

byte[] plaintext = System.Text.Encoding.UTF8.GetBytes("AAAAAAAAAAAAA"); TextReader trCer = new StreamReader(@"AA.key"); //key in PEM format PemReader rdCer = new PemReader(trCer); AsymmetricCipherKeyPair o = rdCer.ReadObject() as…
beto
  • 21
  • 1
  • 2
2
votes
0 answers

Converting DER Encoded Key to PEM Format in Java

I am writing Java code to create a pair of RSA keys using the class KeyPairGenerator (which as I understand are created in DER format). I am then wanting to utilize some of the key's bytes in another separate calculation. Therefore, I presume I need…
geofrey rainey
  • 242
  • 1
  • 12
2
votes
1 answer

Sign file with .der-Certificate and create signature (pkcs#7)

The thing I would like to do is: Sign a zip-file with openssl using a certificate and create a signature-file (pkcs#7) What I have/I did so far: I installed openssl and opened the console I created a rsa key (openssl genrsa -out key.pem 2048) I…
Peter Müller
  • 23
  • 1
  • 5
2
votes
1 answer

Convert RSA pem key String to der byte[]

I'm trying to convert an RSA pem key (contained in a String) to a byte[], like this method does when given a .pem file…
Shaun Scovil
  • 3,905
  • 5
  • 39
  • 58
2
votes
1 answer

openssl RSA public key does not match key read from C code

I've created a public key file using the following commands: openssl genrsa -out mykey.pem 2046 openssl rsa -in mykey.pem -pubout > mykey.pub I then read it from some C code: public_key = PEM_read_RSA_PUBKEY(fp, NULL, NULL, NULL); and then obtain…
Alan Cabrera
  • 694
  • 1
  • 8
  • 16
2
votes
2 answers

When should numbers used to derive RSA private key have leading `00`?

Given an RSA private key... -----BEGIN RSA PRIVATE…
Billy Moon
  • 57,113
  • 24
  • 136
  • 237
2
votes
1 answer

BouncyCastle Java - Decoding DER encoded OCTET strings

I'm reading in a CER certificate file which gives me an X.509 certificate object. There are several extensions that contain DER encoded OCTET strings. e.g.: Certificate Extensions: 9 [1]: ObjectId: 1.3.6.1.4.1.311.21.10 Criticality=false Extension…
user1513388
  • 7,165
  • 14
  • 69
  • 111
2
votes
1 answer

Can a public key be exported in PEM format rather than DER format using BouncyCastle?

I currently use bouncy castle to generate a RSA key pair and export them into files. Currently, the keys are exported in DER format. I would like to know if it is possible to export them in .PEM format instead.
Heshan Perera
  • 4,592
  • 8
  • 44
  • 57
2
votes
2 answers

Encode a RSA public key to DER format

I need a RSA public key encoded into DER format. The key-pair is generated using RSACryptoServiceProvider. What I'm looking for is the c# equivalent to the java: PublicKey pubKey = myPair.getPublic(); byte[] keyBytes = pubKey.getEncoded(); I have…
hultqvist
  • 17,451
  • 15
  • 64
  • 101
1
vote
1 answer

Go, DER and handling big integers

I want to create a Google Go application that will be able to DER encode and decode big integers (namely, ECDSA signature r and s). From what I understand I should use the asn1 package, but what functions should I be calling? For example, I want to…
ThePiachu
  • 8,695
  • 17
  • 65
  • 94