Skip to content

proposal: crypto/x509: support extending list of algorithms #34844

Description

@denisvolin

What version of Go are you using (go version)?

-- go1.12.4

Does this issue reproduce with the latest release?

-- Probably, yes too.

What operating system and processor architecture are you using (go env)?

-- Linux, amd64

What did you do?

Used a test.cer file which contains encoded pkix certificate using GOST 34.10-2001 algorithm
and attempted to extract the name with:

package main

import (
      "io"
      "os"
      dio "custom/package"
)

func main() {
	file, err := os.Open("test.cer")
	if err != nil {
		fmt.Println("file opening error:", err)
		return
	}

	defer file.Close() //nolint:errcheck

	data, err := dio.ReadOut(file) // reads out the io.Reader until an error
	if err != nil && err != io.EOF {
		fmt.Println("file reading error:", err)
		return
	}

	cert, err := x509.ParseCertificate(data)
	if err != nil {
		fmt.Println("error on parsing:", err)
	} else {
		fmt.Println(cert.PublicKeyAlgorithm)
        }
}

What did you expect to see?

Some name, for example GOST 34.10-2001.

What did you see instead?

0

This issue intentionally repeats closed issue, due to the updates made to the Linux kernel, earlier this year, which included the support for the GOST encryption, which makes the original issue close reason, as stated by the contributor, Adam Langley: not carrying it's weight, ― obsolete, in my opinion.

I suggest that package x509 at very least should support extending the list of the supported algorithms defining a way to extend the x509 package with external packages, the same way image package can be extended. Which essentially means, that the whole crypto package and specifically it's hash sub-package, both need to adopt the same changes.

After all new algorithms are popping out, old become vulnerable and thus obsolete, some countries, e.g. China, India, Israel, Russia, ― are defining cryptography algorithms out of the default, so far, range. In my opinion, packages crypto, crypto/hash and crypto/x509 need to allow the user to extend the usage, allowing other implementations to comply with the unified interface, skipping the necessity to comply only with crypto package by redefining the whole x509 from the scratch.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions