cipher

package
v0.0.0-...-ef8ae41 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 19, 2017 License: Apache-2.0 Imports: 3 Imported by: 3

Documentation

Overview

Copyright 2017 Google Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	PaddingPKCS7 = Padding("PKCS7Padding")
	PaddingPKCS5 = Padding("PKCS5Padding")
)
View Source
const (
	ModeEcb = Mode("ECB")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AesCipher

type AesCipher struct {
	// contains filtered or unexported fields
}

An object to perform AES encryption/decryption.

func CreateAesCipher

func CreateAesCipher(key []byte) (*AesCipher, error)

Create a new AesCipher object with the specified encryption mode and padding algorithm.

func (*AesCipher) Decrypt

func (a *AesCipher) Decrypt(ciphertext []byte, mode Mode, padding Padding) (plaintext []byte, err error)

Decrypt the ciphertext. Padding is removed after decryption, so the plaintext output can have different length from input ciphertext.

func (*AesCipher) Encrypt

func (a *AesCipher) Encrypt(plaintext []byte, mode Mode, padding Padding) (ciphertext []byte, err error)

Encrypt the plaintext. Padding is performed before encryption, so the plaintext input can have any length.

type ErrModeUnsupported

type ErrModeUnsupported struct {
	// contains filtered or unexported fields
}

func (*ErrModeUnsupported) Error

func (e *ErrModeUnsupported) Error() string

type ErrPaddingUnsupported

type ErrPaddingUnsupported struct {
	// contains filtered or unexported fields
}

func (*ErrPaddingUnsupported) Error

func (e *ErrPaddingUnsupported) Error() string

type Mode

type Mode string

type Padding

type Padding string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL