使用PKCS 7加密 [英] Using PKCS 7 Cryptography

查看:862
本文介绍了使用PKCS 7加密的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用 PKCS7(CMS)加密和签名数据。
我使用bouncy城​​堡提供的api来实现这个使用java。
到现在为止,我明白我需要按照这些步骤


  1. 需要生成密钥对private&公共密钥使用一些算法 RSA

  2. 使用 X509 / li>
  3. 将其转换为 PKCS7 键格式,如p7b

  4. 使用keytool生成java密钥存储库 *。jks 文件

  5. 使用keytool生成证书签名请求命令 *。crt

  6. 成为自己 CA(Certificate Autority)

  7. 从之前信息中创建的密钥库导入密钥并加密签名和解密数据

需要找出我需要遵循什么步骤来签名,加密,解密数据。

我的问题是



<
  • 我如何验证由RSA算法生成的密钥对并转换为PKCS7密钥格式

  • >我如何成为自己的CA并认证

  • 我获得了


  • 解决方案

    加密和签名,但我仍对其中的步骤感到困惑。

    您需要的不是 BouncyCastle



    您需要 OpenSSL 和指南。


    1. OpenSSL


    2. 如何设置自己的证书颁发机构


    3. 如何创建自签名证书


    4. 如何在Java中使用证书


    或者,使用Java生成和存储RSA密钥:



    生成RSA密钥对,并将字符串编码为字符串


    I need to encrypt and sign data using PKCS7(CMS). I am using bouncy castle provided api to achieve this using java . Till now what i understood is i need to follow these steps

    1. Need to generate a key pair private & public key using some algorithm say RSA
    2. Certify it with X509 certificate
    3. Convert it into PKCS7 key format like p7b
    4. Generate java key store using keytool some *.jks file
    5. Generate the Certificate Signing Request (CSR) using keytool command *.crt
    6. Become self CA(Certificate Autority) and certify
    7. Import key from keystore created in previous stem and encrypt sign and decrypt data

    I still need to figure out what steps i need to follow to sign,encrypt,decrypt data.
    My question is

    1. Is my steps are correct ?
    2. How do i certify key pair generated by RSA algorithm and convert into PKCS7 key format
    3. How do i become self CA and certify
    4. I got this to encrypt and sign, still i am confused with steps to follow and also most of them are deprecated.

    解决方案

    What you need is not BouncyCastle.

    You need OpenSSL and a guide.

    1. OpenSSL

    2. How to set up your own certificate authority

    3. How to create a self-signed certificate

    4. How to use a certificate in Java

    Alternatively, to generate and store an RSA key using Java:

    Generate RSA key pair and encode private as string

    这篇关于使用PKCS 7加密的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆