PageRenderTime 51ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/js/lib/Socket.IO-node/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/cert/X509CertificateCollection.as

http://github.com/onedayitwillmake/RealtimeMultiplayerNodeJs
ActionScript | 57 lines | 18 code | 7 blank | 32 comment | 0 complexity | 052f79ba8a463ceb3a1418e7f68ec9a9 MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1, MPL-2.0-no-copyleft-exception, BSD-3-Clause
  1. /**
  2. * X509CertificateCollection
  3. *
  4. * A class to store and index X509 Certificates by Subject.
  5. * Copyright (c) 2007 Henri Torgemane
  6. *
  7. * See LICENSE.txt for full license information.
  8. */
  9. package com.hurlant.crypto.cert {
  10. public class X509CertificateCollection {
  11. private var _map:Object;
  12. public function X509CertificateCollection() {
  13. _map = {};
  14. }
  15. /**
  16. * Mostly meant for built-in CA loading.
  17. * This entry-point allows to index CAs without parsing them.
  18. *
  19. * @param name A friendly name. not currently used
  20. * @param subject base64 DER encoded Subject principal for the Cert
  21. * @param pem PEM encoded certificate data
  22. *
  23. */
  24. public function addPEMCertificate(name:String, subject:String, pem:String):void {
  25. _map[subject] = new X509Certificate(pem);
  26. }
  27. /**
  28. * Adds a X509 certificate to the collection.
  29. * This call will force the certificate to be parsed.
  30. *
  31. * @param cert A X509 certificate
  32. *
  33. */
  34. public function addCertificate(cert:X509Certificate):void {
  35. var subject:String = cert.getSubjectPrincipal();
  36. _map[subject] = cert;
  37. }
  38. /**
  39. * Returns a X509 Certificate present in the collection, given
  40. * a base64 DER encoded X500 Subject principal
  41. *
  42. * @param subject A Base64 DER-encoded Subject principal
  43. * @return A matching certificate, or null.
  44. *
  45. */
  46. public function getCertificate(subject:String):X509Certificate {
  47. return _map[subject];
  48. }
  49. }
  50. }