Search in sources :

Example 1 with RangerKeyStore

use of org.apache.hadoop.crypto.key.RangerKeyStore in project ranger by apache.

the class TestRangerKeyStore method testInvalidKey1.

@Test(expected = IOException.class)
public void testInvalidKey1() throws NoSuchAlgorithmException, CertificateException, IOException, KeyStoreException {
    DaoManager daoManager = Mockito.mock(DaoManager.class);
    RangerKeyStore rangerKeyStore = new RangerKeyStore(daoManager);
    String keyValue = "enckey:1";
    InputStream inputStream = generateKeyStoreFile(keyValue);
    rangerKeyStore.engineLoadKeyStoreFile(inputStream, storePass, keyPass, masterKey, fileFormat);
    inputStream.close();
}
Also used : FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) RangerKeyStore(org.apache.hadoop.crypto.key.RangerKeyStore) DaoManager(org.apache.ranger.kms.dao.DaoManager) Test(org.junit.Test)

Example 2 with RangerKeyStore

use of org.apache.hadoop.crypto.key.RangerKeyStore in project ranger by apache.

the class TestRangerKeyStore method testInvalidKey2.

@Test(expected = IOException.class)
public void testInvalidKey2() throws NoSuchAlgorithmException, CertificateException, IOException, KeyStoreException {
    DaoManager daoManager = Mockito.mock(DaoManager.class);
    RangerKeyStore rangerKeyStore = new RangerKeyStore(daoManager);
    String keyValue = "1%enckey";
    InputStream inputStream = generateKeyStoreFile(keyValue);
    rangerKeyStore.engineLoadKeyStoreFile(inputStream, storePass, keyPass, masterKey, fileFormat);
    inputStream.close();
}
Also used : FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) RangerKeyStore(org.apache.hadoop.crypto.key.RangerKeyStore) DaoManager(org.apache.ranger.kms.dao.DaoManager) Test(org.junit.Test)

Example 3 with RangerKeyStore

use of org.apache.hadoop.crypto.key.RangerKeyStore in project ranger by apache.

the class TestRangerKeyStore method testValidKey2.

@Test
public void testValidKey2() throws NoSuchAlgorithmException, CertificateException, IOException, KeyStoreException {
    DaoManager daoManager = Mockito.mock(DaoManager.class);
    RangerKeyStore rangerKeyStore = new RangerKeyStore(daoManager);
    String keyValue = "1-enckey_test";
    InputStream inputStream = generateKeyStoreFile(keyValue);
    rangerKeyStore.engineLoadKeyStoreFile(inputStream, storePass, keyPass, masterKey, fileFormat);
    inputStream.close();
}
Also used : FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) RangerKeyStore(org.apache.hadoop.crypto.key.RangerKeyStore) DaoManager(org.apache.ranger.kms.dao.DaoManager) Test(org.junit.Test)

Example 4 with RangerKeyStore

use of org.apache.hadoop.crypto.key.RangerKeyStore in project ranger by apache.

the class TestRangerKeyStore method testValidKey1.

@Test
public void testValidKey1() throws NoSuchAlgorithmException, CertificateException, IOException, KeyStoreException {
    DaoManager daoManager = Mockito.mock(DaoManager.class);
    RangerKeyStore rangerKeyStore = new RangerKeyStore(daoManager);
    String keyValue = "enckey_1-test";
    InputStream inputStream = generateKeyStoreFile(keyValue);
    rangerKeyStore.engineLoadKeyStoreFile(inputStream, storePass, keyPass, masterKey, fileFormat);
    inputStream.close();
}
Also used : FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) RangerKeyStore(org.apache.hadoop.crypto.key.RangerKeyStore) DaoManager(org.apache.ranger.kms.dao.DaoManager) Test(org.junit.Test)

Example 5 with RangerKeyStore

use of org.apache.hadoop.crypto.key.RangerKeyStore in project ranger by apache.

the class TestRangerKeyStore method testInvalidKey3.

@Test(expected = IOException.class)
public void testInvalidKey3() throws NoSuchAlgorithmException, CertificateException, IOException, KeyStoreException {
    DaoManager daoManager = Mockito.mock(DaoManager.class);
    RangerKeyStore rangerKeyStore = new RangerKeyStore(daoManager);
    String keyValue = "1 enckey";
    InputStream inputStream = generateKeyStoreFile(keyValue);
    rangerKeyStore.engineLoadKeyStoreFile(inputStream, storePass, keyPass, masterKey, fileFormat);
    inputStream.close();
}
Also used : FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) RangerKeyStore(org.apache.hadoop.crypto.key.RangerKeyStore) DaoManager(org.apache.ranger.kms.dao.DaoManager) Test(org.junit.Test)

Aggregations

FileInputStream (java.io.FileInputStream)6 InputStream (java.io.InputStream)6 RangerKeyStore (org.apache.hadoop.crypto.key.RangerKeyStore)6 DaoManager (org.apache.ranger.kms.dao.DaoManager)6 Test (org.junit.Test)6