Skip to content

mergermarket/go-pkcs7

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-pkcs7

Simple package to pad and unpad data with PKCS7.

Details

It's common to use PKCS7 to pad and unpad data when using AES encryption. As far as I can tell, though Go has AES-128 encryption in its standard packages, it doesn't offer PKCS7 padding.

This package is designed to use while you're using the standard AES implementation.

Usage

import (
	"log"
	"github.com/richkzad/go-pkcs7"
)

original := []byte("hello")

var padded []byte
if padded, err := pkcs7.Pad(original, 16); err != nil {
	log.Fatalln(err)
}

var result []byte
if result, err := pkcs7.Unpad(padded, 16); err != nil {
	log.Fatalln(err)
}

About

Simple PKCS7 padding functions for Go

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages