Package org.apache.solr.util
Class CryptoKeys
- java.lang.Object
-
- org.apache.solr.util.CryptoKeys
-
public final class CryptoKeys extends Object
A utility class to verify signatures
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CryptoKeys.RSAKeyPair
-
Constructor Summary
Constructors Constructor Description CryptoKeys(Map<String,byte[]> trustedKeys)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static String
decodeAES(String base64CipherTxt, String pwd)
static String
decodeAES(String base64CipherTxt, String pwd, int keySizeBits)
static byte[]
decryptRSA(byte[] buffer, PublicKey pubKey)
static PublicKey
deserializeX509PublicKey(String pubKey)
static PublicKey
getX509PublicKey(byte[] buf)
Create PublicKey from a .DER filestatic void
main(String[] args)
String
verify(String sig, ByteBuffer data)
Try with all signatures and return the name of the signature that matchedstatic boolean
verify(PublicKey publicKey, byte[] sig, ByteBuffer data)
Verify the signature of a file
-
-
-
Method Detail
-
verify
public String verify(String sig, ByteBuffer data)
Try with all signatures and return the name of the signature that matched
-
getX509PublicKey
public static PublicKey getX509PublicKey(byte[] buf) throws Exception
Create PublicKey from a .DER file- Throws:
Exception
-
verify
public static boolean verify(PublicKey publicKey, byte[] sig, ByteBuffer data) throws InvalidKeyException, SignatureException
Verify the signature of a file- Parameters:
publicKey
- the public key used to sign thissig
- the signaturedata
- The data tha is signed- Throws:
InvalidKeyException
SignatureException
-
decryptRSA
public static byte[] decryptRSA(byte[] buffer, PublicKey pubKey) throws InvalidKeyException, BadPaddingException, IllegalBlockSizeException
-
-