Ejemplo n.º 1
0
 public AuthenticatedSessionCryptor(string login, string password, PublicKeyX509Certificate certificate)
 {
     //      TODO: validate params
     this.login       = login;
     this.password    = password;
     this.certificate = certificate;
 }
 public AuthenticatedSessionCryptor(string login, string password, PublicKeyX509Certificate certificate)
 {
   //      TODO: validate params
   this.login = login;
   this.password = password;
   this.certificate = certificate;
 }
    /// <exception cref="ArgumentNullException">cert cannot be null</exception>
    public EncryptionUtil(PublicKeyX509Certificate cert)
    {
      if (null == cert)
      {
        throw new ArgumentNullException("cert cannot be null");
      }

      this.certificate = cert;
    }
Ejemplo n.º 4
0
        /// <exception cref="ArgumentNullException">cert cannot be null</exception>
        public EncryptionUtil(PublicKeyX509Certificate cert)
        {
            if (null == cert)
            {
                throw new ArgumentNullException("cert cannot be null");
            }

            this.certificate = cert;
        }
        public void Setup()
        {
            string modulus  = "v4oNDJlxRJB7svUE3U3dTuJeqr/qtwyccCAQZkbKICOVs8ECuh/CTKks3YyGPbcUdriMqmwjbIP5KSxI22/2QfvaDRSUoXQLzq+pr4MNKyL9ZPI3g2fcByCQPa45LMUfBgbqA6uggET/Tj6SI87l0mgPL6wZwoAFHOrVfGHLSRcuKHZTrfXSoiB7l24RgeArXTGuDbQ3b5eLPXowv5kCsdDvzg//nlED4kQ/HphrSd5XCYBXXTbZrTtwxRWpi/Y0MucX1xn34TLb6VFhZ2AKqlsYKG2Wxjlt/4bxMKAPsz31q4Cv1xulkP6jX9sivkNUKFDncyMmxuXx4/rIlL7zxw==";
            string exponent = "AQAB";

            this.publicCertificate = new PublicKeyX509Certificate(modulus, exponent);

            modulus  = "v4oNDJlxRJB7svUE3U3dTuJeqr/qtwyccCAQZkbKICOVs8ECuh/CTKks3YyGPbcUdriMqmwjbIP5KSxI22/2QfvaDRSUoXQLzq+pr4MNKyL9ZPI3g2fcByCQPa45LMUfBgbqA6uggET/Tj6SI87l0mgPL6wZwoAFHOrVfGHLSRcuKHZTrfXSoiB7l24RgeArXTGuDbQ3b5eLPXowv5kCsdDvzg//nlED4kQ/HphrSd5XCYBXXTbZrTtwxRWpi/Y0MucX1xn34TLb6VFhZ2AKqlsYKG2Wxjlt/4bxMKAPsz31q4Cv1xulkP6jX9sivkNUKFDncyMmxuXx4/rIlL7zxw==";
            exponent = "AQAB";
            this.privateCertificate = new PublicKeyX509Certificate(modulus, exponent);
        }
        public void TestXmlParserDoesNotDependOnNodeOrder()
        {
            string validXml = "<RSAKeyValue><Exponent>AQAB</Exponent><Modulus>0jvvnZgV2r8hlQ6rPIFcoQxJntKBnu3dsmPVzv+diFpkEHrQxX1XRz3KK2f4EBqXASEXFQrluJda7c0d82p76HFjcORGqF5/iTvnlEXotzgy+dAa4BGYa//LNp4DFOipfdvGQlN7lZJyRZqaXGVryueyBHK6MiT6KPcoDmZNZN8=</Modulus></RSAKeyValue>";

            using (Stream xmlStream = new MemoryStream(Encoding.UTF8.GetBytes(validXml)))
            {
                PublicKeyX509Certificate result = this.parser.Parse(xmlStream, CancellationToken.None);

                Assert.AreEqual(result.ModulusInBase64, "0jvvnZgV2r8hlQ6rPIFcoQxJntKBnu3dsmPVzv+diFpkEHrQxX1XRz3KK2f4EBqXASEXFQrluJda7c0d82p76HFjcORGqF5/iTvnlEXotzgy+dAa4BGYa//LNp4DFOipfdvGQlN7lZJyRZqaXGVryueyBHK6MiT6KPcoDmZNZN8=");
                Assert.AreEqual(result.ExponentInBase64, "AQAB");
            }
        }
        public void TestXmlParserFetchesValidDataCorrectly()
        {
            string validXml = VALID_PUBLIC_KEY_XML;

            using (Stream xmlStream = new MemoryStream(Encoding.UTF8.GetBytes(validXml)))
            {
                PublicKeyX509Certificate result = this.parser.Parse(xmlStream, CancellationToken.None);

                Assert.AreEqual(result.ModulusInBase64, "0jvvnZgV2r8hlQ6rPIFcoQxJntKBnu3dsmPVzv+diFpkEHrQxX1XRz3KK2f4EBqXASEXFQrluJda7c0d82p76HFjcORGqF5/iTvnlEXotzgy+dAa4BGYa//LNp4DFOipfdvGQlN7lZJyRZqaXGVryueyBHK6MiT6KPcoDmZNZN8=");
                Assert.AreEqual(result.ExponentInBase64, "AQAB");
            }
        }
Ejemplo n.º 8
0
 public void Dispose()
 {
     this.login       = null;
     this.password    = null;
     this.certificate = null;
 }
 public void TearDown()
 {
     this.publicCertificate  = null;
     this.privateCertificate = null;
 }
 public void Dispose()
 {
   this.login = null;
   this.password = null;
   this.certificate = null;
 }