backup
authorDuncan Mac-Vicar P <dmacvicar@suse.de>
Thu, 20 Apr 2006 11:01:00 +0000 (11:01 +0000)
committerDuncan Mac-Vicar P <dmacvicar@suse.de>
Thu, 20 Apr 2006 11:01:00 +0000 (11:01 +0000)
devel/devel.dmacvicar/zypp-keyring.cc [new file with mode: 0644]
devel/devel.dmacvicar/zypp-lock.cc [new file with mode: 0644]

diff --git a/devel/devel.dmacvicar/zypp-keyring.cc b/devel/devel.dmacvicar/zypp-keyring.cc
new file mode 100644 (file)
index 0000000..3cb7b58
--- /dev/null
@@ -0,0 +1,110 @@
+#include <iostream>
+#include <fstream>
+#include <sstream>
+#include <streambuf>
+
+#include "boost/filesystem/operations.hpp" // includes boost/filesystem/path.hpp
+#include "boost/filesystem/fstream.hpp"    // ditto
+
+#include <boost/iostreams/device/file_descriptor.hpp>
+
+#include <zypp/base/Logger.h>
+#include <zypp/Locale.h>
+#include <zypp/ZYpp.h>
+#include <zypp/ZYppFactory.h>
+#include <zypp/TranslatedText.h>
+///////////////////////////////////////////////////////////////////
+
+#include <zypp/parser/yum/YUMParser.h>
+#include <zypp/base/Logger.h>
+#include <zypp/target/rpm/RpmDb.h>
+#include <zypp/source/yum/YUMScriptImpl.h>
+#include <zypp/source/yum/YUMMessageImpl.h>
+#include <zypp/source/yum/YUMPackageImpl.h>
+#include <zypp/source/yum/YUMSourceImpl.h>
+
+#include <map>
+#include <set>
+
+#include <zypp/CapFactory.h>
+#include <zypp/KeyRing.h>
+
+using namespace zypp::detail;
+
+using namespace std;
+using namespace zypp;
+using namespace zypp::parser::yum;
+using namespace zypp::source::yum;
+
+
+
+//using namespace DbXml;
+
+int main()
+{
+  //ZYpp::Ptr z = getZYpp();
+  getZYpp()->keyRing()->importKey("duncan.asc", true);
+  zypp::target::rpm::RpmDb rpm;
+  rpm.initDatabase();
+  
+  std::set<Edition> rpm_keyse = rpm.pubkeyEditions();
+  for (std::set<Edition>::const_iterator it = rpm_keyse.begin(); it != rpm_keyse.end(); it++)
+  {
+    MIL << "RPM key edition: " << (*it).version() << std::endl;
+  }
+  MIL << "-----------------------------------------------------------" << std::endl;
+  std::list<PublicKey> rpm_keys = rpm.pubkeys();
+  for (std::list<PublicKey>::const_iterator it = rpm_keys.begin(); it != rpm_keys.end(); it++)
+  {
+    MIL << "RPM key: [" << (*it).id << "] [" << (*it).name << "] [" << (*it).fingerprint << "]" << std::endl;
+  }
+  MIL << "-----------------------------------------------------------" << std::endl;
+  std::list<PublicKey> keys = getZYpp()->keyRing()->trustedPublicKeys();
+  for (std::list<PublicKey>::const_iterator it = keys.begin(); it != keys.end(); it++)
+  {
+    MIL << "Trusted key: [" << (*it).id << "] [" << (*it).name << "] [" << (*it).fingerprint << "]" << std::endl;
+  } 
+  
+//   KeyRing kr(Pathname("./keyring/all"), Pathname("./keyring/trusted"));
+//   kr.importKey(Pathname("content.key"));
+//   kr.verifyFileSignatureWorkflow(Pathname("repomd.xml.asc"), Pathname("repomd.xml.asc")); 
+//   exit(0);
+//   
+//   KeyRing kr(Pathname("./keyring/all"), Pathname("./keyring/trusted"));
+//   kr.importKey(Pathname("content.key"));
+//   kr.verifyFileSignatureWorkflow(Pathname("content.asc"), Pathname("content.asc")); 
+//   exit(0);
+//  
+  
+//   std::string sid = kr.readSignatureKeyId("content", "content.asc");
+//   MIL << "Signature: " << sid << std::endl;
+//   
+//   PublicKey key = kr.readPublicKey("./content.key");
+//   MIL << "Read: " << key.id << " " << key.name << std::endl;
+//   
+//   kr.importKey(Pathname("content.key"));
+//   std::list<PublicKey> keys;
+//   keys = kr.publicKeys();
+//   
+//   bool verifies;
+//   verifies = kr.verifyFileSignature( Pathname("./content"), Pathname("./content.asc"));
+//   MIL << "verifying " << verifies << std::endl;
+//   
+//   for (std::list<PublicKey>::const_iterator it = keys.begin(); it != keys.end(); it++)
+//   {
+//     MIL << (*it).id << " " << (*it).name << std::endl;
+//     MIL << "now delete it" << std::endl;
+//     kr.deleteKey((*it).id);
+//   } 
+//   
+//   verifies = kr.verifyFileSignature( Pathname("./content"), Pathname("./content.asc"));
+//   MIL << "verifying " << verifies << std::endl;
+//   
+//   MIL << "now delete a non.existant key" << std::endl;
+//   kr.deleteKey("ADhjghjghg");
+//   
+  
+  
+}
+
+
diff --git a/devel/devel.dmacvicar/zypp-lock.cc b/devel/devel.dmacvicar/zypp-lock.cc
new file mode 100644 (file)
index 0000000..8a8d6d5
--- /dev/null
@@ -0,0 +1,54 @@
+#include <iostream>
+#include <fstream>
+#include <sstream>
+#include <streambuf>
+
+#include "boost/filesystem/operations.hpp" // includes boost/filesystem/path.hpp
+#include "boost/filesystem/fstream.hpp"    // ditto
+
+#include <boost/iostreams/device/file_descriptor.hpp>
+
+#include <zypp/base/Logger.h>
+#include <zypp/Locale.h>
+#include <zypp/ZYpp.h>
+#include <zypp/ZYppFactory.h>
+#include <zypp/TranslatedText.h>
+///////////////////////////////////////////////////////////////////
+
+#include <zypp/parser/yum/YUMParser.h>
+#include <zypp/base/Logger.h>
+#include <zypp/source/yum/YUMScriptImpl.h>
+#include <zypp/source/yum/YUMMessageImpl.h>
+#include <zypp/source/yum/YUMPackageImpl.h>
+#include <zypp/source/yum/YUMSourceImpl.h>
+
+#include <map>
+#include <set>
+
+#include <zypp/CapFactory.h>
+
+using namespace zypp::detail;
+
+using namespace std;
+using namespace zypp;
+using namespace zypp::parser::yum;
+using namespace zypp::source::yum;
+
+
+
+//using namespace DbXml;
+
+int main()
+{
+  try
+  { 
+    ZYpp::Ptr z = getZYpp();
+    //while(1);
+  }
+  catch (...)
+  {
+    MIL << "sorry" << std::endl;
+  } 
+}
+
+