Package org.apache.solr.util
Class CryptoKeys.RSAKeyPair
- java.lang.Object
-
- org.apache.solr.util.CryptoKeys.RSAKeyPair
-
- Enclosing class:
- CryptoKeys
public static class CryptoKeys.RSAKeyPair extends Object
-
-
Constructor Summary
Constructors Constructor Description RSAKeyPair()
Create an RSA key pair with newly generated keys.RSAKeyPair(URL privateKeyResourceName, URL publicKeyResourceName)
Initialize an RSA key pair from previously saved keys.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]
encrypt(ByteBuffer buffer)
PublicKey
getPublicKey()
String
getPublicKeyStr()
byte[]
signSha256(byte[] bytes)
-
-
-
Constructor Detail
-
RSAKeyPair
public RSAKeyPair()
Create an RSA key pair with newly generated keys.
-
RSAKeyPair
public RSAKeyPair(URL privateKeyResourceName, URL publicKeyResourceName) throws IOException, InvalidKeySpecException
Initialize an RSA key pair from previously saved keys. The formats listed below have been tested, other formats may also be acceptable but are not guaranteed to work.- Parameters:
privateKeyResourceName
- path to private key file, encoded as a PKCS#8 in a PEM filepublicKeyResourceName
- path to public key file, encoded as X509 in a DER file- Throws:
IOException
- if an I/O error occurs reading either key fileInvalidKeySpecException
- if either key file is inappropriate for an RSA key
-
-
Method Detail
-
getPublicKeyStr
public String getPublicKeyStr()
-
getPublicKey
public PublicKey getPublicKey()
-
encrypt
public byte[] encrypt(ByteBuffer buffer)
-
signSha256
public byte[] signSha256(byte[] bytes)
-
-