Go Home Page
The Go Programming Language

Package aes

import "crypto/aes"

This package implements AES encryption (formerly Rijndael), as defined in U.S. Federal Information Processing Standards Publication 197.

Package files

block.go cipher.go const.go

Constants

The AES block size in bytes.

const BlockSize = 16

type Cipher

A Cipher is an instance of AES encryption using a particular key.

type Cipher struct {
    // contains unexported fields
}

func NewCipher

func NewCipher(key []byte) (*Cipher, os.Error)

NewCipher creates and returns a new Cipher. The key argument should be the AES key, either 16, 24, or 32 bytes to select AES-128, AES-192, or AES-256.

func (*Cipher) BlockSize

func (c *Cipher) BlockSize() int

BlockSize returns the AES block size, 16 bytes. It is necessary to satisfy the Cipher interface in the package "crypto/block".

func (*Cipher) Decrypt

func (c *Cipher) Decrypt(src, dst []byte)

Decrypt decrypts the 16-byte buffer src using the key k and stores the result in dst.

func (*Cipher) Encrypt

func (c *Cipher) Encrypt(src, dst []byte)

Encrypt encrypts the 16-byte buffer src using the key k and stores the result in dst. Note that for amounts of data larger than a block, it is not safe to just call Encrypt on successive blocks; instead, use an encryption mode like CBC (see crypto/block/cbc.go).

func (*Cipher) Reset

func (c *Cipher) Reset()

Reset zeros the key data, so that it will no longer appear in the process's memory.

type KeySizeError

type KeySizeError int

func (KeySizeError) String

func (k KeySizeError) String() string