Search in sources :

Example 6 with EncryptionManager

use of org.orcid.core.manager.EncryptionManager in project ORCID-Source by ORCID.

the class CheckHashMatches method main.

@SuppressWarnings("resource")
public static void main(String[] args) {
    ApplicationContext context = new ClassPathXmlApplicationContext("orcid-core-context.xml");
    EncryptionManager encyrptionManager = (EncryptionManager) context.getBean("encryptionManager");
    long startTime = System.currentTimeMillis();
    boolean matched = encyrptionManager.hashMatches(args[0], args[1]);
    long duration = System.currentTimeMillis() - startTime;
    System.out.println("Took: " + duration);
    System.out.println("Matched: " + matched);
}
Also used : ClassPathXmlApplicationContext(org.springframework.context.support.ClassPathXmlApplicationContext) ApplicationContext(org.springframework.context.ApplicationContext) EncryptionManager(org.orcid.core.manager.EncryptionManager) ClassPathXmlApplicationContext(org.springframework.context.support.ClassPathXmlApplicationContext)

Example 7 with EncryptionManager

use of org.orcid.core.manager.EncryptionManager in project ORCID-Source by ORCID.

the class EncryptForExternalUse method main.

@SuppressWarnings("resource")
public static void main(String[] args) {
    try {
        ApplicationContext context = new ClassPathXmlApplicationContext("orcid-core-context.xml");
        EncryptionManager encyrptionManager = (EncryptionManager) context.getBean("encryptionManager");
        System.out.println(encyrptionManager.encryptForExternalUse(args[0]));
    } catch (Throwable t) {
        System.out.println(t);
    } finally {
        System.exit(0);
    }
}
Also used : ClassPathXmlApplicationContext(org.springframework.context.support.ClassPathXmlApplicationContext) ApplicationContext(org.springframework.context.ApplicationContext) EncryptionManager(org.orcid.core.manager.EncryptionManager) ClassPathXmlApplicationContext(org.springframework.context.support.ClassPathXmlApplicationContext)

Aggregations

EncryptionManager (org.orcid.core.manager.EncryptionManager)7 ApplicationContext (org.springframework.context.ApplicationContext)5 ClassPathXmlApplicationContext (org.springframework.context.support.ClassPathXmlApplicationContext)5 Arrays (java.util.Arrays)1 Date (java.util.Date)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Set (java.util.Set)1 IntStream (java.util.stream.IntStream)1 StringUtils (org.apache.commons.lang3.StringUtils)1 Assert.assertEquals (org.junit.Assert.assertEquals)1 Assert.assertNotNull (org.junit.Assert.assertNotNull)1 Assert.assertNull (org.junit.Assert.assertNull)1 Assert.assertTrue (org.junit.Assert.assertTrue)1 Before (org.junit.Before)1 Test (org.junit.Test)1 Mock (org.mockito.Mock)1 Mockito (org.mockito.Mockito)1 Mockito.verify (org.mockito.Mockito.verify)1 Mockito.when (org.mockito.Mockito.when)1