@Test public void retrieveEncryptedPrivateKeyFromDocument() throws Exception { XWikiDocument storeDoc = mock(XWikiDocument.class); when(xwiki.getDocument(new DocumentReference(WIKI, SPACE, DOCUMENT), xcontext)).thenReturn(storeDoc); BaseObject certObj = mock(BaseObject.class); when(storeDoc.getXObject(X509CertificateWikiStore.CERTIFICATECLASS)).thenReturn(certObj); when(certObj.getLargeStringValue(X509CertificateWikiStore.CERTIFICATECLASS_PROP_CERTIFICATE)).thenReturn(ENCODED_CERTIFICATE); BaseObject pkObj = mock(BaseObject.class); when(storeDoc.getXObject(X509KeyWikiStore.PRIVATEKEYCLASS)).thenReturn(pkObj); when(pkObj.getLargeStringValue(X509KeyWikiStore.PRIVATEKEYCLASS_PROP_KEY)).thenReturn(ENCODED_ENCRYPTED_PRIVATEKEY); CertifiedKeyPair keyPair = store.retrieve(DOC_STORE_REF, PASSWORD); assertThat(keyPair, notNullValue()); assertThat(keyPair.getPrivateKey(), equalTo(privateKey)); assertThat(keyPair.getCertificate(), equalTo((CertifiedPublicKey) certificate)); }
@Override public CertifiedKeyPair retrieve(StoreReference store) throws KeyStoreException { return retrieve(store, (byte[]) null); }
X509KeyWikiStore extends AbstractX509WikiStore implements KeyStore { @Override public CertifiedKeyPair retrieve(StoreReference store) throws KeyStoreException { return retrieve(store, (byte[]) null); } }
X509KeyWikiStore extends AbstractX509WikiStore implements KeyStore { @Override public CertifiedKeyPair retrieve(StoreReference store) throws KeyStoreException { return retrieve(store, (byte[]) null); }  }
X509KeyWikiStore extends AbstractX509WikiStore implements KeyStore { @Override public CertifiedKeyPair retrieve(StoreReference store) throws KeyStoreException { return retrieve(store, (byte[]) null); }  @Override void store(StoreReference store, CertifiedKeyPair keyPair); @Override void store(StoreReference store, CertifiedKeyPair keyPair, byte[] password); @Override CertifiedKeyPair retrieve(StoreReference store); @Override CertifiedKeyPair retrieve(StoreReference store, byte[] password); @Override CertifiedKeyPair retrieve(StoreReference store, CertifiedPublicKey publicKey); @Override CertifiedKeyPair retrieve(StoreReference store, CertifiedPublicKey certificate, byte[] password); }
X509KeyWikiStore extends AbstractX509WikiStore implements KeyStore { @Override public CertifiedKeyPair retrieve(StoreReference store) throws KeyStoreException { return retrieve(store, (byte[]) null); }  @Override void store(StoreReference store, CertifiedKeyPair keyPair); @Override void store(StoreReference store, CertifiedKeyPair keyPair, byte[] password); @Override CertifiedKeyPair retrieve(StoreReference store); @Override CertifiedKeyPair retrieve(StoreReference store, byte[] password); @Override CertifiedKeyPair retrieve(StoreReference store, CertifiedPublicKey publicKey); @Override CertifiedKeyPair retrieve(StoreReference store, CertifiedPublicKey certificate, byte[] password); static final String PRIVATEKEYCLASS_SPACE; static final String PRIVATEKEYCLASS_NAME; static final String PRIVATEKEYCLASS_FULLNAME; static final LocalDocumentReference PRIVATEKEYCLASS; static final String PRIVATEKEYCLASS_PROP_KEY; }