Git Product home page Git Product logo

gox509inspector's Introduction

Go Report Card gopherbadger-tag-do-not-edit Workflow Status

gox509inspector

Go tool to inspect x.509 certificates in PEM format

API

/*
Parsex509Cert takes an io.Reader in input and returns an x509 certificate and nil
if no errors occurred while reading and parsing the certificate.
If the certificate has reminder data, both the certificate and the error will be returned.
*/
func Parsex509Cert(r io.Reader) (*x509.Certificate, error)
/*
GetQuickInfo returns the certificate's most useful info as a byte array

Version             int
SerialNumber        *big.Int
Issuer              pkix.Name
Subject             pkix.Name
NotBefore, NotAfter time.Time // Validity bounds.
KeyUsage            KeyUsage
*/
func GetQuickInfo(c *x509.Certificate) []byte

Example usage

package main

import (
	"fmt"
	"gox509inspector/inspector"
	"os"
)

func main() {
	// pipe certificate in
	c, err := inspector.Parsex509Cert(os.Stdin)
	if c == nil {
		fmt.Fprintln(os.Stderr, err)
		os.Exit(1)
	}
	if err != nil {
		fmt.Fprintln(os.Stdout, err)
	}

	bytes := inspector.GetQuickInfo(c)
	fmt.Print(string(bytes))
}

// Output
// Version:        3
// SerialNumber:   2098790
// Issuer:         CN=CA,O=SSOCircle,C=DE
// Subject:        CN=idp.ssocircle.com,O=SSOCircle,C=DE
// Valid from:     2016-08-03 16:03:23 +0100 BST
// Valid to:       2026-03-04 15:03:23 +0000 GMT

gox509inspector's People

Contributors

indiependente avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

deemount

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.