@Test public void storingPrivateKeyToCertificateSpace() throws Exception { XWikiDocument storeDoc = mock(XWikiDocument.class); when(xwiki.getDocument(new DocumentReference(WIKI, SPACE, ENCODED_SUBJECTKEYID), xcontext)).thenReturn(storeDoc); BaseObject certObj = mock(BaseObject.class); when(storeDoc.getXObject(X509CertificateWikiStore.CERTIFICATECLASS, 0)).thenReturn(certObj); when(query.<Object[]>execute()).thenReturn(Collections.singletonList(new Object[]{"space." + ENCODED_SUBJECTKEYID, 0})); BaseObject pkObj = mock(BaseObject.class); when(storeDoc.newXObject(X509KeyWikiStore.PRIVATEKEYCLASS, xcontext)).thenReturn(pkObj); store.store(SPACE_STORE_REF, keyPair); verify(certObj).setLargeStringValue(X509CertificateWikiStore.CERTIFICATECLASS_PROP_CERTIFICATE, ENCODED_CERTIFICATE); verify(pkObj).setLargeStringValue(X509KeyWikiStore.PRIVATEKEYCLASS_PROP_KEY, ENCODED_PRIVATEKEY); verify(xwiki).saveDocument(storeDoc, xcontext); }
@Override public void store(StoreReference store, CertifiedKeyPair keyPair) throws KeyStoreException { storeKeyPair(store, keyPair.getCertificate(), keyPair.getPrivateKey().getEncoded()); }
X509KeyWikiStore extends AbstractX509WikiStore implements KeyStore { @Override public void store(StoreReference store, CertifiedKeyPair keyPair) throws KeyStoreException { storeKeyPair(store, keyPair.getCertificate(), keyPair.getPrivateKey().getEncoded()); } }
X509KeyWikiStore extends AbstractX509WikiStore implements KeyStore { @Override public void store(StoreReference store, CertifiedKeyPair keyPair) throws KeyStoreException { storeKeyPair(store, keyPair.getCertificate(), keyPair.getPrivateKey().getEncoded()); }  }
X509KeyWikiStore extends AbstractX509WikiStore implements KeyStore { @Override public void store(StoreReference store, CertifiedKeyPair keyPair) throws KeyStoreException { storeKeyPair(store, keyPair.getCertificate(), keyPair.getPrivateKey().getEncoded()); }  @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 void store(StoreReference store, CertifiedKeyPair keyPair) throws KeyStoreException { storeKeyPair(store, keyPair.getCertificate(), keyPair.getPrivateKey().getEncoded()); }  @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; }