Distinguished Encoding Rules (DER) certificate encoding is a method of turning ASN.1 attributes and values into a machine-friendly format.
Questions tagged [der]
215 questions
7
votes
1 answer
install X509 certificate programmatically in my case
I am developing an Android project. I have a PEM certificate string:
-----BEGIN…

Leem.fin
- 40,781
- 83
- 202
- 354
7
votes
1 answer
Do java.security.Key.getEncoded() return data in DER encoded format?
Do java.security.Key.getEncoded() returns data in DER encoded format?
If not, is there a method that do?
UPDATE: A Key interface holding an RSA private key implementation

The Student
- 27,520
- 68
- 161
- 264
6
votes
1 answer
How to generate a DER/PEM certificate from public exponent and modulus of RSA?
As we know, a public key consists of a public exponent and a modulus.
My questions is:
How to generate a DER/PEM certificate from public exponent and modulus of RSA?
Thank you very much in advance.

xmllmx
- 39,765
- 26
- 162
- 323
6
votes
1 answer
Convert signature from P1363 to ASN.1/DER format using Crypto++?
I have a signature created this way:
size_t siglenth = _signer.MaxSignatureLength();
QByteArray signature(siglenth, 0x00);
signature.reserve(siglenth);
siglenth = _signer.SignMessage(_prng,
(const CryptoPP::byte*) (message.constData()),
…

pipou
- 270
- 3
- 15
6
votes
1 answer
Bouncycastle DER length IO error:
This is my method:
import org.bouncycastle.asn1.ASN1InputStream;
import java.io.ByteArrayInputStream;
...
public static byte[] toDERBytes(byte[] data) throws IOException
{
ByteArrayInputStream inStream = new ByteArrayInputStream(data);
…

Martin Clemens Bloch
- 1,047
- 1
- 12
- 28
6
votes
1 answer
How to generate RSA Private key from *pem string in Java
I want to generate the private key from a string(a .pem file) in Java.
private static final String test = "-----BEGIN RSA PRIVATE KEY-----\n" +
"MIIEpAIBAAKCAQEAvcCH8WsT1xyrZqq684VPJzOF3hN5DNbowZ96Ie//PN0BtRW2\n" +
// and so on
…

Niklas
- 23,674
- 33
- 131
- 170
5
votes
2 answers
Encoding of implicit and explicit tags in ASN.1
I am trying to understand how IMPLICIT and EXPLICIT tags are actually encoded in the DER binary form.
The basic examples are clear. Plain integer,
x INTEGER ::= 5
is encoded as a TLV triple 02 01 05. In
x [2] IMPLICIT INTEGER ::= 5
implicit tag 82…

klk206
- 454
- 4
- 8
5
votes
1 answer
PEM encoded certificate conversion in iOS
In my app I get a PEM encoded certificate and need to convert it into a different form to later use it for JWT verification purposes. The result I'm looking for is either a SecKey representation of the public key contained in the certificate, PEM…

dj-neza
- 198
- 1
- 11
5
votes
2 answers
How read a PKCS8 encrypted Private key which is also encoded in DER with bouncycastle?
I have tried answers of these questions:
Bouncy Castle : PEMReader => PEMParser
Read an encrypted private key with bouncycastle/spongycastle
However as my encrypted key is encoded in DER when I call
Object object = pemParser.readObject();
object…

Aloxi
- 85
- 2
- 8
4
votes
1 answer
From base64-encoded public key in DER format to COSE key, in Python
I have a base64-encoded public key in DER format.
In Python, how can I convert it into a COSE key?
Here is my failed attempt:
from base64 import b64decode
from cose.keys import CoseKey
pubkeyder = "...=="
decCborData.key =…

Bob
- 1,713
- 10
- 23
4
votes
3 answers
C# read der encoded private key
How can I get the fields from ASN1 DER format private key? Is there a library to decode and get the fields separately?
I need to extract the modulus, exponent and all the other fields.
Or maybe is there a way to convert it to .net xml format?

hs2d
- 6,027
- 24
- 64
- 103
4
votes
1 answer
OpenSsl cannot read DER formatted certificate
Update
I have based my solution on this and this answers.
Background
I am trying to read a DER formatted certificate file and attempt to verify it.
My cert is in DER format. I have confirmed this by:
Using openssl command line:
openssl x509 -text…

raidensan
- 1,099
- 13
- 31
4
votes
1 answer
Interpreting ASN.1 indefinite-lenght encoding with multiple encapsulated octet-strings
I have a BER structure like this...
$ openssl asn1parse -inform der -in test.der -i -dump
????:d=4 hl=2 l=inf cons: cont [ 0 ]
????:d=5 hl=3 l= 240 prim: OCTET STRING
0000 - AABBCCDD
????:d=5 hl=2 l= 8 prim: OCTET…

duesee
- 141
- 1
- 9
4
votes
1 answer
Convert certificate string to byte array
I got a string represents PEM certificate:
-----BEGIN…

Leem.fin
- 40,781
- 83
- 202
- 354
4
votes
1 answer
DER Decode ECDSA Signature in Java
I have generated an ECDSA signature in Java and I would like to get the R and S values from it. It is my understanding that the signature I have generated is DER encoded. Can someone please provide me with some Java code (maybe using Bouncy Castle)…

Hmmmmm
- 778
- 9
- 20