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 classCryptoKeys.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 StringdecodeAES(String base64CipherTxt, String pwd)static StringdecodeAES(String base64CipherTxt, String pwd, int keySizeBits)static byte[]decryptRSA(byte[] buffer, PublicKey pubKey)static PublicKeydeserializeX509PublicKey(String pubKey)static PublicKeygetX509PublicKey(byte[] buf)Create PublicKey from a .DER filestatic voidmain(String[] args)Stringverify(String sig, ByteBuffer data)Try with all signatures and return the name of the signature that matchedstatic booleanverify(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:
 InvalidKeyExceptionSignatureException
 
- 
decryptRSA
public static byte[] decryptRSA(byte[] buffer, PublicKey pubKey) throws InvalidKeyException, BadPaddingException, IllegalBlockSizeException 
 - 
 
 -