ASN1 | An ASN.1 Library for PHP | TLS library
kandi X-RAY | ASN1 Summary
kandi X-RAY | ASN1 Summary
FreeDSx ASN1 is a PHP library for dealing with ASN.1 data structures. Its original focus was on ASN.1 BER encoding used in LDAP as part of the FreeDSx LDAP library. It was moved to its own library to allow for additional encoders and reuse in other projects.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Encode a type .
- Canonicalizes a set of types .
- Creates a bit string from an integer .
- Validate a time type .
- Validate a type .
- Set the date time format .
- Add child type
- Returns true if value is big int
- Creates an enumerated type
- Ber encoder .
ASN1 Key Features
ASN1 Examples and Code Snippets
Community Discussions
Trending Discussions on ASN1
QUESTION
I have the following ASN1 ASN.1 dump
...ANSWER
Answered 2021-May-27 at 07:03The document hash is not calculated from the original PDF you want to sign. That PDF first is prepared for signing by applying certain changes, and then the hash is calculated from this prepared PDF except a placeholder gap in it prepared to later house the signature container.
In DetailTo create an integrated PDF signature, certain changes have to be applied to the PDF:
- The holder of the to-be-integrated signature is an AcroForm form field in the PDF. If the PDF does not contain an empty, unused signature field (or no existing field shall be used), a new signature field has to be added to the PDF.
- A signature form field may have a visualization, a widget annotation, which represents the signature on some page of the document itself. If such a visualization is desired, a matching annotation has to be added to the PDF.
- Information describing the mode and other details of signing have to be added to the PDF. Thus, the value of the chosen signature field has to be set to a new dictionary object in the PDF with these signature details; there are two special entries here, the ByteRange and the Contents. Both are set to blank values of appropriate size for starters.
- A marker is added to the PDF root AcroForm object indicating that the PDF is signed.
With these additions the PDF is stored. Thereafter the position of the Contents value in the file is fixed and the blank value of the ByteRange value is patched to an array of four integers, the start offset and size of the file segment before the Contents value and the start offset and size of the file segment thereafter.
Then the bytes of these segments of the file are hashed and a CMS signature container signing this document hash is generated which in turn is injected into the Contents value.
In your case the hash you find in the to-be-signed attributes,
QUESTION
I am trying to allow users to store .pem and .key file text string in my rails database, but when i try to read them using OpenSSL::X509::Certificate.new and OpenSSL::PKey::RSA.new, I get the following error: OpenSSL::X509::CertificateError: nested asn1 error. Is there a better way to go about doing this?
...ANSWER
Answered 2021-May-26 at 06:20With pem key
you can use this simple way:
QUESTION
I built the Apache Oozie 5.2.1 from the source code in my MacOS and currently having trouble running it. The ClassNotFoundException indicates a missing class org.apache.hadoop.conf.Configuration but it is available in both libext/ and the Hadoop file system.
I followed the 1st approach given here to copy Hadoop libraries to Oozie binary distro. https://oozie.apache.org/docs/5.2.1/DG_QuickStart.html
I downloaded Hadoop 2.6.0 distro and copied all the jars to libext before running Oozie in addition to other configs, etc as specified in the following blog.
https://www.trytechstuff.com/how-to-setup-apache-hadoop-2-6-0-version-single-node-on-ubuntu-mac/
This is how I installed Hadoop in MacOS. Hadoop 2.6.0 is working fine. http://zhongyaonan.com/hadoop-tutorial/setting-up-hadoop-2-6-on-mac-osx-yosemite.html
This looks pretty basic issue but could not find why the jar/class in libext is not loaded.
- OS: MacOS 10.14.6 (Mojave)
- JAVA: 1.8.0_191
- Hadoop: 2.6.0 (running in the Mac)
ANSWER
Answered 2021-May-09 at 23:25I was able to sort the above issue and few other ClassNotFoundException by copying the following jar files from extlib to lib. Both folder are in oozie_install/oozie-5.2.1.
- libext/hadoop-common-2.6.0.jar
- libext/commons-configuration-1.6.jar
- libext/hadoop-mapreduce-client-core-2.6.0.jar
- libext/hadoop-hdfs-2.6.0.jar
While I am not sure how many more jars need to be moved from libext to lib while I try to run an example workflow/job in oozie. This fix brought up Oozie web site at http://localhost:11000/oozie/
I am also not sure why Oozie doesn't load the libraries in the libext/ folder.
QUESTION
I am trying to find the Python-equivalent of running openssl ec -pubin -in example.pem -inform PEM -outform DER conv_form compressed
Example using the following public key:
...ANSWER
Answered 2021-May-08 at 07:51The first key posted is a public key in X.509/SPKI format (PEM encoded), which contains the actual key in uncompressed format 0x04 + +
.
The key derived from this using the OpenSSL statement is also a public key in X.509/SPKI format, but contains the actual key in compressed format 0x02 +
or 0x03 +
for even or odd y
, respectively. This format also contains the complete information, since for a given curve an uncompressed key can be derived from a compressed key.
X.509/SPKI keys can be parsed with an ASN.1 parser (in addition to OpenSSL), e.g. online: https://lapo.it/asn1js.
In Python, an X.509/SPKI key with uncompressed key can be converted to an X.509/SPKI key with compressed key using the PyCryptodome library, see export_key()
:
QUESTION
In an effort to become better with Haskell, I'm rewriting a small CLI that I developed originally in Python. The CLI mostly makes GET requests to an API and allows for filtering/formatting the JSON result.
I'm finding my Haskell version to be a lot slower than my Python one.
To help narrow down the problem, I excluded all parts of my Haskell code except the fetching of data - essentially, it's this:
...ANSWER
Answered 2021-May-02 at 00:04It seemed odd that the performance of a common Haskell library was so slow for me, but somehow this approach solved my concerns:
I found that the performance of my executable was faster when I used stack install
to copy the binaries:
QUESTION
Yesterday I tried to install Ejabberd first through souce code, and then with Ubuntu specific packages.
I guess I made a mess, because now I'm getting this threatening Crash dump
error.
ANSWER
Answered 2021-Apr-27 at 07:46Yesterday I tried to install Ejabberd first through souce code
Just curiosity: what problems did you find, that prefered to use the Ubuntu package?
Did you install from source code? If so, did you later uninstall it? Maybe uninstallation left some files there (there was some bug related to that in make uninstall)... it will help if you can take a look at the installation paths and remove the remaining ejabberd files and directories, specially the file ejabberdctl.
and then with Ubuntu specific packages
Well, it could be that both installations get mixed... or maybe the Ubuntu package has some problem unrelated to your previous installation. Keep all investigation lines open :)
{"init terminating in [do_boot",{undef,[{ejabberd_ctl,start,[],
This error message says that erlang cannot find the file ejabberd_ctl.beam, or that the file doesn't define the function start.
Just a wild idea: maybe you are running the "ejabberdctl" script from source installation (pointing to the old ejabberd beam files), but now you have the ejabberd beam files installed in a different location (by the Ubuntu package).
QUESTION
I am trying to extract the AuthorityKeyIdentifier (OID:2.5.29.35) form a valid certificate using bouncycastle in scala.
...ANSWER
Answered 2021-Apr-20 at 14:36Ok, I think I found the mistake.
In
QUESTION
I'm lost in a twisty maze of openssl command line options, seemingly all alike...
A public datasheet from a chip company shows this public key for use in chip authentication with secp224r1: 048A9B380AF2EE1B98DC417FECC263F8449C7625CECE82D9B916C992DA209D68 422B81EC20B65A66B5102A61596AF3379200599316A00A1410
I have saved it do disk as ascii-hex and as binary. I cannot find the openssl magic spell to make it into a PEM public key for signature verification. These are my best failed attempts:
...ANSWER
Answered 2021-Apr-16 at 13:53The public key is given in uncompressed format: 0x04 + + .
A format for a public key suitable for verification with OpenSSL is X.509/SPKI. As far as I know, OpenSSL cannot convert between the two formats. But the conversion can easily be done manually.
The X509/SPKI format contains the uncompressed key at the end, the front part is identical for a certain curve e.g. secp224r1:
QUESTION
I'm training to asymmetric encryption with RSA. I created a key pair with ssh-keygen, and I managed to encrypt some data with my public key. But when I try to decrypt this data with my private key, this exception is raised :
...ANSWER
Answered 2021-Apr-13 at 17:34The posted private key is a PEM encoded PKCS#1 key that is encrypted.
RSA.ImportRSAPrivateKey()
can only import unencrypted keys of this format that are furthermore DER encoded. The DER encoding results from the PEM encoding by removing the header and footer and Base64 decoding the rest.
As far as I know, an encrypted PKCS#1 key cannot be imported with .NET Core 3.1 on-board means. But an import is possible with BouncyCastle and its Org.BouncyCastle.OpenSsl.PemReader
class, see e.g. here.
Unlike the PKCS#1 format, a DER encoded private key in PKCS#8 format can be imported with .NET Core 3.1 out of the box (RSA.ImportPkcs8PrivateKey()
), even if it is encrypted (RSA.ImportEncryptedPkcs8PrivateKey()
).
Keys of this format can be generated e.g. with openssl genpkey. With OpenSSL it is also possible to convert between the formats.
QUESTION
While trying to decrypt encrypted RSA private keys with java runtime is set with property
-Dorg.bouncycastle.fips.approved_only=true is throwing below error
unable to read encrypted data: 1.2.840.113549.1.5.3 not available: requires PBE parameters
Tpl required
bc-fips-1.0.1.jar
bcpkix-fips-1.0.3.jar
Sample code
...ANSWER
Answered 2021-Apr-08 at 20:131.2.840.113549.1.5.3 is PBEwithMD5andDES-CBC, one of the PBES1 schemes in PKCS5. MD5 is not NIST-approved and cannot generally be used in FIPS mode (there are some specific exceptions like the TLS1.0-1 PRF). (Single/classic) DES was NIST-approved but withdrawn in the early oughties, and anyway it's completely broken.
I'm going to guess you or someone created this PKCS8 with openssl pkcs8 -topk8
in an older version -- it defaulted to this scheme, which was barely reasonable when OpenSSL (then SSLeay) was created in the 1990s but retained past its sell-by date. 1.1.0 (released 2016) up changes the default to PBES2 with hmac-sha256 and aes-256-cbc, and in lower versions you can specify -v2 aes-256-cbc
for PBES2 (but hmac-sha1 for the PRF, which TTBOMK is still FIPS and actually secure even though sha1 signatures or at least certificates are broken and generally prohibited since about 2015).
BouncyCastle can read (and decrypt) PBES2 correctly since more or less forever, but the standard providers in Java versions below 11.0.1 mishandle all PBES2, and even after that they don't handle all cases. If these are concerns, -v1 PBE-SHA1-3DES
(which is actually a PKCS12 scheme not PKCS5v1, but OpenSSL lumps them together) should be good for FIPS and compatible with both BouncyCastle and standard providers.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install ASN1
PHP requires the Visual C runtime (CRT). The Microsoft Visual C++ Redistributable for Visual Studio 2019 is suitable for all these PHP versions, see visualstudio.microsoft.com. You MUST download the x86 CRT for PHP x86 builds and the x64 CRT for PHP x64 builds. The CRT installer supports the /quiet and /norestart command-line switches, so you can also script it.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page