Example #1
0
 public I2PSigningPrivateKey(BigInteger key, I2PCertificate cert) : base(key, cert)
 {
     if (cert.SignatureType == SigningKeyTypes.EdDSA_SHA512_Ed25519)
     {
         ExpandedPrivateKey = Chaos.NaCl.Ed25519.ExpandedPrivateKeyFromSeed(ToByteArray());
     }
 }
Example #2
0
 public I2PDestinationInfo(BufRef reader)
 {
     Certificate       = new I2PCertificate(reader);
     PrivateKey        = new I2PPrivateKey(reader, Certificate);
     PublicKey         = new I2PPublicKey(reader, Certificate);
     PrivateSigningKey = new I2PSigningPrivateKey(reader, Certificate);
     PublicSigningKey  = new I2PSigningPublicKey(reader, Certificate);
 }
Example #3
0
 public I2PSigningPrivateKey(I2PCertificate cert)
     : base(new BufLen(BufUtils.RandomBytes(cert.SigningPrivateKeyLength)), cert)
 {
     if (cert.SignatureType == SigningKeyTypes.EdDSA_SHA512_Ed25519)
     {
         ExpandedPrivateKey = Chaos.NaCl.Ed25519.ExpandedPrivateKeyFromSeed(ToByteArray());
     }
 }
Example #4
0
        public I2PKeysAndCert(I2PPublicKey pubkey, I2PSigningPublicKey signkey)
        {
            Data = new BufLen(new byte[RecordSize(signkey.Certificate)]);

            Data.Randomize();
            Certificate      = signkey.Certificate;
            PublicKey        = pubkey;
            SigningPublicKey = signkey;
        }
Example #5
0
        public I2PDestinationInfo(string base64)
        {
            var reader = new BufRefLen(FreenetBase64.Decode(base64));

            Certificate       = new I2PCertificate(reader);
            PrivateKey        = new I2PPrivateKey(reader, Certificate);
            PublicKey         = new I2PPublicKey(reader, Certificate);
            PrivateSigningKey = new I2PSigningPrivateKey(reader, Certificate);
            PublicSigningKey  = new I2PSigningPublicKey(reader, Certificate);
        }
Example #6
0
        public I2PDestinationInfo(I2PSigningKey.SigningKeyTypes signkeytype)
        {
            Certificate = new I2PCertificate(signkeytype);
            var keys = I2PPrivateKey.GetNewKeyPair();

            PublicKey  = keys.PublicKey;
            PrivateKey = keys.PrivateKey;

            PrivateSigningKey = new I2PSigningPrivateKey(Certificate);
            PublicSigningKey  = new I2PSigningPublicKey(PrivateSigningKey);
        }
Example #7
0
 public I2PDestinationInfo(
     I2PCertificate cert,
     I2PPublicKey pubkey,
     I2PSigningPublicKey spubkey,
     I2PPrivateKey privkey,
     I2PSigningPrivateKey sprivkey)
 {
     Certificate       = cert;
     PublicKey         = pubkey;
     PrivateKey        = privkey;
     PrivateSigningKey = sprivkey;
     PublicSigningKey  = spubkey;
 }
Example #8
0
        public I2PSigningKey(BigInteger key, I2PCertificate cert) : base(cert)
        {
            var buf = key.ToByteArrayUnsigned();

            if (buf.Length == KeySizeBytes)
            {
                Key = new BufLen(buf);
            }
            else
            {
                Key = new BufLen(new byte[KeySizeBytes]);
                Key.Poke(buf, KeySizeBytes - buf.Length);
            }
        }
Example #9
0
 public I2PSigningKey(BufLen key, I2PCertificate cert)
     : base(cert)
 {
     if (key.Length == KeySizeBytes)
     {
         Key = key;
     }
     else if (key.Length < KeySizeBytes)
     {
         Key = new BufLen(new byte[KeySizeBytes]);
         Key.Poke(key, KeySizeBytes - key.Length);
     }
     else
     {
         Key = new BufLen(key, 0, KeySizeBytes);
     }
 }
Example #10
0
 public I2PSignature()
 {
     Certificate = I2PSigningKey.DefaultSigningKeyCert;
     Sig         = new BufLen(new byte[Certificate.SignatureLength]);
 }
Example #11
0
 public I2PPublicKey(BigInteger pubkey, I2PCertificate cert) : base(cert)
 {
     Key = new BufLen(pubkey.ToByteArrayUnsigned());
 }
Example #12
0
 public I2PPublicKey(BufRef buf, I2PCertificate cert) : base(buf, cert)
 {
 }
Example #13
0
 public I2PKeyType(BufRef buf, I2PCertificate cert)
 {
     Certificate = cert;
     Key         = buf.ReadBufLen(KeySizeBytes);
 }
Example #14
0
 protected I2PKeyType(I2PCertificate cert)
 {
     Certificate = cert;
 }
Example #15
0
 public I2PSigningPublicKey(BufRef buf, I2PCertificate cert) : base(cert)
 {
     Key = buf.ReadBufLen(KeySizeBytes);
 }
Example #16
0
        public I2PKeysAndCert(BufRef reader)
        {
            var cert = new I2PCertificate(new BufRef(reader, 256 + 128));

            Data = reader.ReadBufLen(RecordSize(cert));
        }
Example #17
0
 public I2PSigningKey(BufRef reader, I2PCertificate cert) : base(reader, cert)
 {
 }
Example #18
0
 protected I2PSigningKey(I2PCertificate cert) : base(cert)
 {
 }
Example #19
0
 public I2PPrivateKey(I2PCertificate cert) : base(cert)
 {
     Key = new BufLen(BufUtils.Random(KeySizeBytes));
 }
Example #20
0
        public I2PSignature(BufRef buf, I2PCertificate cert)
        {
            Certificate = cert;

            Sig = buf.ReadBufLen(cert.SignatureLength);
        }
Example #21
0
 private int RecordSize(I2PCertificate cert)
 {
     return(256 + 128 + cert.CertLength);
 }
Example #22
0
 public I2PPrivateKey(I2PCertificate cert) : base(cert)
 {
     Key     = new BufLen(BufUtils.RandomBytes(KeySizeBytes));
     Key[0] |= 0x80;
     Key[Key.Length - 1] |= 0x01;
 }
Example #23
0
 public I2PPrivateKey(BufRef reader, I2PCertificate cert) : base(reader, cert)
 {
 }
Example #24
0
 public I2PSigningPublicKey(BigInteger key, I2PCertificate cert) : base(key, cert)
 {
 }