obbsubjectextractor

package module
v0.0.0-...-8622b4d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 22, 2022 License: Apache-2.0 Imports: 11 Imported by: 1

README

OpenBanking Brasil Subject DN extractor

Using this lib you will be capable of extract the subject DN following RFC 4514 definitions, with aditional translation of OIDs to names specified by the OpenBanking Brasil security specs.

The implementation follows the rules at August 26, 2021.

History

Version Date (aprox.) of spec
initial August 26, 2021

Installation

Lib
go get github.com/esachser/obbsubjectextractor
Command
go get github.com/esachser/obbsubjectextractor/cmd/obbsubextractor

Usage - lib

Example from the cmd folder;

import (
	"crypto/x509"
	"encoding/pem"
	"flag"
	"fmt"
	"os"
	"path/filepath"

	"github.com/esachser/obbsubjectextractor"
)

func main() {
	filename := os.Args[1]
	pemFile, _ := os.ReadFile(filename)
	pemBlock, _ := pem.Decode(pemFile)
	cert, _ := x509.ParseCertificate(pemBlock.Bytes)

	subjectDN, err := obbsubjectextractor.ExtractSubject(cert)

	fmt.Println(subjectDN, err)
}

Usage - command

obbsubextractor <path-to-pem>

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractSubject

func ExtractSubject(cert *x509.Certificate) (string, error)

ExtractSubject Returns the subject DN of certificate in accordance to Brazilian Security specs <https://openbanking-brasil.github.io/specs-seguranca>

Types

This section is empty.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL