承接 semeton/crypto-service 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

semeton/crypto-service

最新稳定版本:1.1.1

Composer 安装命令:

composer require semeton/crypto-service

包简介

This package provides a simple and secure way to encrypt and decrypt messages in Laravel applications. It uses Sodium cryptographic library for encryption and decryption, ensuring high-level security. The package is easy to integrate into any Laravel application and requires minimal configuration. I

README 文档

README

CryptoService is a package that provides a simple yet secure way to encrypt and decrypt messages using a secret code. It leverages the power of the Sodium cryptographic library to ensure the highest level of security. This document provides a comprehensive guide on how to install and use CryptoService, along with a detailed explanation of its methods.

Installation

Installing CryptoService is a breeze with the package manager composer. Follow the link to download and install composer if you have not already. composer require semeton/crypto-service

CryptoService Class Documentation

Overview

The CryptoService class provides encryption and decryption services using the Sodium cryptographic library. It uses a secret key of a 64 bits of random string.

Methods

encrypt(string $message, string $secretCode): string

This method encrypts a given message.

  • Parameters: - $message (string): The message to be encrypted. - $secretCode (string): A secret code used in the encryption process.
  • Returns: The encrypted message as a base64-encoded string.
  • Description: This method generates a random nonce and uses it along with the $message and a hashed combination of $key and $secretCode to create an encrypted cipher. The cipher is then base64-encoded for safe transmission or storage. The memory of the $message and $key is cleared after encryption for security reasons.

decrypt(string $encrypted, string $secretCode): string

This method decrypts a given encrypted message.

  • Parameters: - $encrypted (string): The message to be decrypted. - $secretCode (string): A secret code used in the decryption process.
  • Returns: The decrypted message as a string. If decryption fails, it returns an error message.
  • Description: This method decodes the $encrypted message, extracts the nonce and ciphertext, and attempts to decrypt the ciphertext using the nonce and a hashed combination of $key and $secretCode. If decryption is successful and the result is a string, it returns the decrypted message. If decryption fails or the result is not a string, it returns an error message. The memory of the ciphertext and $key is cleared after decryption for security reasons.

统计信息

  • 总下载量: 5
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-01-02