How to convert Byte array to PrivateKey or PublicKey type?
问题 I am using RSA algorithm to generate public and private key final KeyPairGenerator keyGen = KeyPairGenerator.getInstance(ALGORITHM); keyGen.initialize(1024); final KeyPair key = keyGen.generateKeyPair(); final PrivateKey privateKey=key.getPrivate(); final PublicKey publickey=key.getPublic(); after that these keys are encoded using Base64 encoder and save it into database. How to convert this encoded String to Private and Public Key Type in java is to decrypt file. when decoding this String