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 and Description
    --- | ---
    `static class` | `CryptoKeys.RSAKeyPair`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CryptoKeys(Map<String,byte[]> trustedKeys)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and 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 file
    `static void` | `main(String[] args)`
    `static boolean` | `verify(PublicKey publicKey, byte[] sig, ByteBuffer data)` Verify the signature of a file
    `String` | `verify(String sig, ByteBuffer data)` Try with all signatures and return the name of the signature that matched

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### CryptoKeys

          public CryptoKeys(Map<String,byte[]> trustedKeys)
                     throws Exception

      Throws:
        `Exception`

  - ### 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 this
        `sig` - the signature
        `data` - The data tha is signed
      Throws:
        `InvalidKeyException`
        `SignatureException`

    - #### decodeAES

          public static String decodeAES(String base64CipherTxt,
                                         String pwd)

    - #### decodeAES

          public static String decodeAES(String base64CipherTxt,
                                         String pwd,
                                         int keySizeBits)

    - #### deserializeX509PublicKey

          public static PublicKey deserializeX509PublicKey(String pubKey)

    - #### decryptRSA

          public static byte[] decryptRSA(byte[] buffer,
                                          PublicKey pubKey)
                                   throws InvalidKeyException,
                                          BadPaddingException,
                                          IllegalBlockSizeException

      Throws:
        `InvalidKeyException`
        `BadPaddingException`
        `IllegalBlockSizeException`

    - #### main

          public static void main(String[] args)
                           throws Exception

      Throws:
        `Exception`

Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.