//Helper function to load a private key from it's bytes
Helper function to load a private key from it's bytes
// Helper function to load a private key from it ' s bytes
func LoadPrivateKeyPEM(buf []byte) (*PKey, error) {
	bio := C.BIO_new_mem_buf(unsafe.Pointer(&buf[0]), C.int(len(buf)))
	if bio == nil {
		return nil, errors.New("problem converting der key to openssl key")
	}
	pkey := C.PEM_read_bio_PrivateKey(bio, nil, nil, nil)
	if pkey == nil {
		return nil, errors.New("Problem reading key:" + sslerr.SSLErrorMessage().String())
	}
	return &PKey{PKey: pkey}, nil
}
func LoadPrivateKeyPEM ( buf [ ] byte ) ( * PKey , error ) { bio := C . BIO_new_mem_buf ( unsafe . Pointer ( & buf [ 0 ] ) , C . int ( len ( buf ) ) ) if bio == nil { return nil , errors . New ( " " ) } pkey := C . PEM_read_bio_PrivateKey ( bio , nil , nil , nil ) if pkey == nil { return nil , errors . New ( " " + sslerr . SSLErrorMessage ( ) . String ( ) ) } return & PKey { PKey : pkey } , nil }
Helper function to load a private key from it's bytes
Helper function to load a private key from it ' s bytes