Exemple #1
0
 // TODO: Add more signature types
 public static bool SupportedSignatureType(I2PSigningKey.SigningKeyTypes stype)
 {
     return(stype == I2PSigningKey.SigningKeyTypes.DSA_SHA1 ||
            stype == I2PSigningKey.SigningKeyTypes.ECDSA_SHA256_P256 ||
            stype == I2PSigningKey.SigningKeyTypes.ECDSA_SHA384_P384 ||
            stype == I2PSigningKey.SigningKeyTypes.ECDSA_SHA512_P521 ||
            stype == I2PSigningKey.SigningKeyTypes.EdDSA_SHA512_Ed25519);
 }
Exemple #2
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);
        }
Exemple #3
0
        public I2PCertificate(I2PSigningKey.SigningKeyTypes signkeytype)
        {
            switch (signkeytype)
            {
            case I2PSigningKey.SigningKeyTypes.DSA_SHA1:
                Data  = new BufLen(new byte[3]);
                CType = CertTypes.NULL;
                break;

            case I2PSigningKey.SigningKeyTypes.ECDSA_SHA256_P256:
                Data             = new BufLen(new byte[3 + 4]);
                CType            = CertTypes.KEY;
                PayloadLength    = 4;
                KEYSignatureType = I2PSigningKey.SigningKeyTypes.ECDSA_SHA256_P256;
                break;

            case I2PSigningKey.SigningKeyTypes.ECDSA_SHA384_P384:
                Data             = new BufLen(new byte[3 + 4]);
                CType            = CertTypes.KEY;
                PayloadLength    = 4;
                KEYSignatureType = I2PSigningKey.SigningKeyTypes.ECDSA_SHA384_P384;
                break;

            case I2PSigningKey.SigningKeyTypes.ECDSA_SHA512_P521:
                Data             = new BufLen(new byte[3 + 4 + 4]);
                CType            = CertTypes.KEY;
                PayloadLength    = 4 + 4;
                KEYSignatureType = I2PSigningKey.SigningKeyTypes.ECDSA_SHA512_P521;
                break;

            case I2PSigningKey.SigningKeyTypes.EdDSA_SHA512_Ed25519:
                Data             = new BufLen(new byte[3 + 4]);
                CType            = CertTypes.KEY;
                PayloadLength    = 4;
                KEYSignatureType = I2PSigningKey.SigningKeyTypes.EdDSA_SHA512_Ed25519;
                break;

            default:
                throw new NotImplementedException();
            }
        }