Giter Site home page Giter Site logo

jetbrains-key's Introduction

功能特点

  • 接收包含许可证信息的JSON请求。
  • 使用BouncyCastle库生成RSA密钥对和X.509证书。
  • 根据请求中的许可证信息生成许可证内容。
  • 对许可证内容进行数字签名。
  • 将许可证、数字签名和证书编码为Base64字符串。
  • 返回Base64编码后的许可证数据作为JSON响应。

技术栈

  • Java
  • Spring Boot
  • BouncyCastle
  • JSON
  • Base64

项目结构

src
├── main
│   ├── java
│   │   └── com
│   │       └── example
│   │           ├── controller
│   │           │   └── LicenseController.java
│   │           ├── entity
│   │           │   ├── LicensePart.java
│   │           │   └── Product.java
│   │           └── utils
│   │           │   ├── CertificateGenerator.java
│   │           │   └── PowerConfRuleGen.java
│   └── resources
│       └── application.properties
└── test
    └── java
        └── com
            └── example
                └── controller
                    └── LicenseControllerTest.java

实体类

  • LicenseRequest: 接收HTTP请求中的许可证信息。
  • Product: 产品实体类,包含产品代码。
  • Result: 通用响应结果实体类,用于封装响应数据。

控制器类

  • LicenseController: 处理生成许可证请求的控制器类,接收LicenseRequest并返回Base64编码的许可证数据。

工具类

  • CertificateGenerator: 证书生成器,用于生成RSA密钥对和X.509证书,并将其写入文件。

接口使用方法

1. 生成许可证接口

  • URL: /generateLicense

  • 请求方法: POST

  • 请求参数:

    {
        "licenseId": "PastKing-Yi",
        "products": [
                        "code": "PS"
            },
            {
            	"code" : "II"
            }
        ]
    }
  • 返回示例:

    {
        "code": "200",
        "message": "Success",
        "data": "PastKing-Yi-eyJsaWNlbnNlSWQiOiJQYXN0S2luZy1ZaSIsImNvZGUiOlsiUFMiXSwiZGF0ZSI6IjIwOTktMTIiLCJzaWciOiJmN2E4NmVlMWMxNzVlMDkyZTlmMTgwN2I1MTQ3NzBmOTU0YjlkZGEyZGYyOWM3ZDlhZjcyZjU2NzNlYmI4ZGY0IiwiaXNzdWVyU2VydmljZUdyb3VwcyI6IlJlYWQiLCJzaWciOiJSU0EifQ=="
    }

部署计划

  • 部署到服务器上时,将使用服务器上的文件路径而不是本地路径,以确保能够正确加载证书和私钥文件。

  • 将生成的许可证文件保存到服务器上的安全目录中,以便应用程序能够访问并提供给客户端。

  • 应该先执行src/main/java/com/example/utils/CertificateGenerator.java生成证书,然后执行src/main/java/com/example/utils/PowerConfRuleGen.java生成EQUAL,x,y,z->r,最后启动工程访问接口即可

jetbrains-key's People

Contributors

pastking avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.