asn.1

How-to check the UID hash of an Apple AppReceipt server side in PHP?

安稳与你 提交于 2020-01-02 08:54:49
问题 I'm asking this question in order to share a solution code. Context: Apple introduced the AppReceipt in iOS 7. It is also present for OS X IAP. This receipt is a PKCS#7 container (asn.1) with a payload which is also asn.1 structured. Documentation from Apple instructs how to control the validity of the receipt on-device and to parse it to check that is has been issued for the current device. There are also instructions to validate the receipt through an application server by contacting Apple

ASN.1 DER formatted private key

五迷三道 提交于 2020-01-01 02:31:52
问题 Why is the modulus padded with leading zeros? I was reading PKCS#1 and PKCS#8 but didn't find anything about it. In c# the leading zeros must be removed, does anybody know why? At http://etherhack.co.uk/asymmetric/docs/rsa_key_breakdown.html, you can see that the modulus and exponent have leading zeros. The question is why they have it, I haven't found an explanation anywhere yet. 回答1: The private key values are encoded as ASN.1 INTEGERs, which are signed values in two's complement format.

asn.1 parser in C/Python

眉间皱痕 提交于 2019-12-31 11:05:06
问题 I am looking for a solution to parse asn.1 spec files and generate a decoder from those. Ideally I would like to work with Python modules, but if nothing is available I would use C/C++ libraries and interface them with Python with the plethora of solutions out there. In the past I have been using pyasn1 and building everything by hand but that has become too unwieldly. I have also looked superficially to libtasn1 and asn1c. The first one had problems parsing even the simplest of files. The

Bouncy Castle example for encoding CDR

邮差的信 提交于 2019-12-25 05:20:07
问题 I am trying to encode PGWRecord CDR using ASN.1 notation, starting on page 89 in this 3GPP TS Document I've been looking for awhile for examples how I can do this, but to no avail. Are there any examples that can show me how to do this using Bouncy Castle ? Or is there a better alternative than Bouncy Castle to encode this CDR? Step by step instructions on how I can do this would be very nice! Any help would be very appreciated. Thanks all! 回答1: Try to look at BinaryNotes. You have ASN.1

parsing DER format data using SecAsn1Decode

瘦欲@ 提交于 2019-12-24 21:32:59
问题 I'm trying to use SecAsn1Decode in order to parse the following DER encoded data. However, I failed to define the template for this struct (represented by SecAsn1Template ). perhaps anybody can explain how to create a template for the following DER structure : here's the binary raw data (DER formatted) 30 81 8E 31 0B 30 09 06 03 55 04 06 13 02 49 4C 31 0F 30 0D 06 03 55 04 08 0C 06 69 73 72 61 65 6C 31 0C 30 0A 06 03 55 04 07 0C 03 54 4C 56 31 0B 30 09 06 03 55 04 0A 0C 02 54 53 31 1E 30 1C

SNMP MIB Table complex data object

不羁岁月 提交于 2019-12-24 12:37:11
问题 Can a table entry include a complex data object? For example can a table entry look like this? ExampleTableEntry ::= SEQUENCE { simpleDataObject1 INTEGER, complexDataObject2 ComplexType, SimpleDataObject3 TruthValue } ComplexType OBJECT-IDENTITY STATUS current DESCRIPTION " What ever " ::= { parent 1 } subObject1 OBJECT-TYPE SYNTAX DisplayString (SIZE (0..255)) MAX-ACCESS read-create STATUS current DESCRIPTION " Diameter peer's host name. Reference: RFC 3588 " ::= { ComplexType 1 } subObject2

Export a certificate in asn.1 notation from X509Certificate2

点点圈 提交于 2019-12-24 01:54:34
问题 I'm currently learning working with certificates and now I'm curious, if it is possible to get the ASN.1 notation of a loaded certificate from a X509Certificate2 -instance. I have found the Export -Method and it works fine, however I have not seen a possibilty to change the encoding of the output format - it's only in the DER-format. Is there a possibility to export/convert a loaded certificate as an ASCII ASN.1 certificate, something like in the example below: Certificate: Data: Version: 3

Creating PublicKey using Oid/ASNEncodeData throws CryptographyException

断了今生、忘了曾经 提交于 2019-12-23 22:26:29
问题 I'm trying to create a PublicKey instance using an Oid and RSA public Key but I'm getting a CryptographyException with "ASN1 bad tag value met". I'm following the answer found here to eventually create a RSACryptoServiceProvider. Here's my code: string pem = @"-----BEGIN PUBLIC KEY----- MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAkxqnUqh5WYis/Q+sQc5h O9i5aX7XvVEVdrhrnFcbwSb1/GyQWPvn1ZydQB88zW9CnNFq08QRg+IYaBYdqs12 EbxkET20eWY7xvI8kBICPxOdYAHBb0JWpdK4GjSCSxCFrJIXXmHtnRqj6PmSoPrb

Decoding an ASN.1 DER OCTET STRING with OpenSSL

心已入冬 提交于 2019-12-21 04:21:24
问题 Using the OpenSSL API, I have extracted a custom extension from a X.509v3 certificate with: X509_EXTENSION* ex = X509_get_ext(x509, 4); The X509_EXTENSION object contains a value (ex->value) that is an ASN.1 OCTET STRING. The OCTET STRING contains a DER encoded UTF-8 string. I'm trying to decode the OCTET STRING to get the plain UTF-8 string. I have tried a few things, such as: ASN1_STRING_to_UTF8(&buf, ex->value); and M_ASN1_OCTET_STRING_print(bio, ex->value); int len = BIO_read(bio, buf,

Verify a DSA signature in C# that's using BER/DER encoded ASN.1 format

空扰寡人 提交于 2019-12-20 14:21:08
问题 How can I verify a DSA signature in C#? Given: the message text, a signed digest (typically ASN.1 DER format), the public key (in a signed X.509 certificate, PEM or DER format) I've tried a number of approaches, but haven't had any success: OpenSSL.NET: various strange errors with the library; I've got an open thread running with the author over on SourceForge but haven't been able to resolve this yet. Microsoft .NET API: can't unpack the DER signature for comparison. A DSA signature is 40