Search in sources :

Example 11 with CertifiedKeyPair

use of org.xwiki.crypto.pkix.params.CertifiedKeyPair in project xwiki-platform by xwiki.

the class X509KeyWikiStoreTest method retrieveMissingPrivateKeyFromSpace.

@Test
public void retrieveMissingPrivateKeyFromSpace() throws Exception {
    XWikiDocument storeDoc = mock(XWikiDocument.class);
    when(xwiki.getDocument(new DocumentReference(WIKI, SPACE, ENCODED_SUBJECTKEYID), xcontext)).thenReturn(storeDoc);
    when(query.<Object[]>execute()).thenReturn(Collections.singletonList(new Object[] { "space." + ENCODED_SUBJECTKEYID, 0 }));
    CertifiedKeyPair keyPair = store.retrieve(SPACE_STORE_REF, certificate);
    assertThat(keyPair, nullValue());
}
Also used : XWikiDocument(com.xpn.xwiki.doc.XWikiDocument) BaseObject(com.xpn.xwiki.objects.BaseObject) LocalDocumentReference(org.xwiki.model.reference.LocalDocumentReference) DocumentReference(org.xwiki.model.reference.DocumentReference) CertifiedKeyPair(org.xwiki.crypto.pkix.params.CertifiedKeyPair) Test(org.junit.Test)

Aggregations

CertifiedKeyPair (org.xwiki.crypto.pkix.params.CertifiedKeyPair)11 XWikiDocument (com.xpn.xwiki.doc.XWikiDocument)9 BaseObject (com.xpn.xwiki.objects.BaseObject)9 Test (org.junit.Test)8 DocumentReference (org.xwiki.model.reference.DocumentReference)7 LocalDocumentReference (org.xwiki.model.reference.LocalDocumentReference)7 X509CertifiedPublicKey (org.xwiki.crypto.pkix.params.x509certificate.X509CertifiedPublicKey)6 CertifiedPublicKey (org.xwiki.crypto.pkix.params.CertifiedPublicKey)4 XWikiContext (com.xpn.xwiki.XWikiContext)3 XWikiException (com.xpn.xwiki.XWikiException)2 IOException (java.io.IOException)2 CertificateStoreException (org.xwiki.crypto.store.CertificateStoreException)2 KeyStoreException (org.xwiki.crypto.store.KeyStoreException)2 XWiki (com.xpn.xwiki.XWiki)1 Before (org.junit.Before)1 AsymmetricKeyFactory (org.xwiki.crypto.AsymmetricKeyFactory)1 BinaryStringEncoder (org.xwiki.crypto.BinaryStringEncoder)1 PrivateKeyParameters (org.xwiki.crypto.params.cipher.asymmetric.PrivateKeyParameters)1 PrivateKeyPasswordBasedEncryptor (org.xwiki.crypto.password.PrivateKeyPasswordBasedEncryptor)1 CertificateFactory (org.xwiki.crypto.pkix.CertificateFactory)1