@Test public void storingEncryptedPrivateKey() 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.newXObject(X509CertificateWikiStore.CERTIFICATECLASS, xcontext)).thenReturn(certObj); BaseObject pkObj = mock(BaseObject.class); when(storeDoc.newXObject(X509KeyWikiStore.PRIVATEKEYCLASS, xcontext)).thenReturn(pkObj); store.store(DOC_STORE_REF, keyPair, PASSWORD); verify(certObj).setStringValue(X509CertificateWikiStore.CERTIFICATECLASS_PROP_KEYID, ENCODED_SUBJECTKEYID); verify(certObj).setStringValue(X509CertificateWikiStore.CERTIFICATECLASS_PROP_ISSUER, ISSUER); verify(certObj).setStringValue(X509CertificateWikiStore.CERTIFICATECLASS_PROP_SERIAL, SERIAL.toString()); verify(certObj).setStringValue(X509CertificateWikiStore.CERTIFICATECLASS_PROP_SUBJECT, SUBJECT); verify(certObj).setLargeStringValue(X509CertificateWikiStore.CERTIFICATECLASS_PROP_CERTIFICATE, ENCODED_CERTIFICATE); verify(pkObj).setLargeStringValue(X509KeyWikiStore.PRIVATEKEYCLASS_PROP_KEY, ENCODED_ENCRYPTED_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; }