example/main.go
func LoadPublicKey(data []byte) (interface{}, error) {
	input := data

	block, _ := pem.Decode(data)
	if block != nil {
		input = block.Bytes
	}

	// Try to load SubjectPublicKeyInfo
	pub, err0 := x509.ParsePKIXPublicKey(input)
	if err0 == nil {
		return pub, nil
	}

	cert, err1 := x509.ParseCertificate(input)
	if err1 == nil {
		return cert.PublicKey, nil
	}

	return nil, fmt.Errorf("square/go-jose: parse error, got '%s' and '%s'", err0, err1)
}
func LoadPublicKey(data []byte) (interface{}, error) {
	input := data

	block, _ := pem.Decode(data)
	if block != nil {
		input = block.Bytes
	}

	// Try to load SubjectPublicKeyInfo
	pub, err0 := x509.ParsePKIXPublicKey(input)
	if err0 == nil {
		return pub, nil
	}

	cert, err1 := x509.ParseCertificate(input)
	if err1 == nil {
		return cert.PublicKey, nil
	}

	return nil, fmt.Errorf("square/go-jose: parse error, got '%s' and '%s'", err0, err1)
}
func LoadPublicKey ( data [ ] byte ) ( interface { } , error ) { input := data block , _ := pem . Decode ( data ) if block != nil { input = block . Bytes } // Try to load SubjectPublicKeyInfo pub , err0 := x509 . ParsePKIXPublicKey ( input ) if err0 == nil { return pub , nil } cert , err1 := x509 . ParseCertificate ( input ) if err1 == nil { return cert . PublicKey , nil } return nil , fmt . Errorf ( " " , err0 , err1 ) }
// LoadPublicKey loads a public key from PEM/DER-encoded data.
LoadPublicKey loads a public key from PEM / DER - encoded data .