Search in sources :

Example 1 with RSASigner

use of de.tum.in.tumcampusapp.utils.RSASigner in project TumCampusApp by TCA-Team.

the class RSASignerTestCase method testAsciiMessageSigning.

/**
 * Tests that a valid ASCII-based message is correctly signed.
 */
@Test
public void testAsciiMessageSigning() {
    signer = new RSASigner(privateKeyFixture);
    ChatMessage message = messageFixtures.get(0);
    assertThat(signer.sign(message.getText())).isEqualTo(message.getSignature());
}
Also used : ChatMessage(de.tum.in.tumcampusapp.component.ui.chat.model.ChatMessage) RSASigner(de.tum.in.tumcampusapp.utils.RSASigner) Test(org.junit.Test)

Example 2 with RSASigner

use of de.tum.in.tumcampusapp.utils.RSASigner in project TumCampusApp by TCA-Team.

the class RSASignerTestCase method testUnicodeMessageSigning.

/**
 * Tests that a unicode (european) message is correctly signed.
 */
@Test
public void testUnicodeMessageSigning() {
    signer = new RSASigner(privateKeyFixture);
    ChatMessage message = messageFixtures.get(1);
    assertThat(signer.sign(message.getText())).isEqualTo(message.getSignature());
}
Also used : ChatMessage(de.tum.in.tumcampusapp.component.ui.chat.model.ChatMessage) RSASigner(de.tum.in.tumcampusapp.utils.RSASigner) Test(org.junit.Test)

Example 3 with RSASigner

use of de.tum.in.tumcampusapp.utils.RSASigner in project TumCampusApp by TCA-Team.

the class RSASignerTestCase method testPrivateKeyNull.

/**
 * Tests that when the private key associated with
 * the signer is null, the signer returns null.
 */
@Test
public void testPrivateKeyNull() {
    signer = new RSASigner(null);
    ChatMessage message = messageFixtures.get(0);
    assertThat(signer.sign(message.getText())).isNull();
}
Also used : ChatMessage(de.tum.in.tumcampusapp.component.ui.chat.model.ChatMessage) RSASigner(de.tum.in.tumcampusapp.utils.RSASigner) Test(org.junit.Test)

Example 4 with RSASigner

use of de.tum.in.tumcampusapp.utils.RSASigner in project TumCampusApp by TCA-Team.

the class RSASignerTestCase method testUnicodeKoreanMessageSigning.

/**
 * Tests that a unicode (korean) message is correctly signed.
 */
@Test
public void testUnicodeKoreanMessageSigning() {
    signer = new RSASigner(privateKeyFixture);
    ChatMessage message = messageFixtures.get(2);
    assertThat(signer.sign(message.getText())).isEqualTo(message.getSignature());
}
Also used : ChatMessage(de.tum.in.tumcampusapp.component.ui.chat.model.ChatMessage) RSASigner(de.tum.in.tumcampusapp.utils.RSASigner) Test(org.junit.Test)

Aggregations

ChatMessage (de.tum.in.tumcampusapp.component.ui.chat.model.ChatMessage)4 RSASigner (de.tum.in.tumcampusapp.utils.RSASigner)4 Test (org.junit.Test)4