Beispiel #1
0
class EncryptedModel(models.Model):
    """Dummy model used for tests to check the fields."""
    digest_field = fields.TextDigestField(blank=True, null=True)
    digest_with_original_field = fields.TextDigestField(
        blank=True, null=True, original='pgp_sym_field')
    hmac_field = fields.TextHMACField(blank=True, null=True)
    hmac_with_original_field = fields.TextHMACField(blank=True,
                                                    null=True,
                                                    original='pgp_sym_field')

    email_pgp_pub_field = fields.EmailPGPPublicKeyField(blank=True,
                                                        null=True,
                                                        unique=True)
    integer_pgp_pub_field = fields.IntegerPGPPublicKeyField(blank=True,
                                                            null=True)
    biginteger_pgp_pub_field = fields.BigIntegerPGPPublicKeyField(blank=True,
                                                                  null=True)
    pgp_pub_field = fields.TextPGPPublicKeyField(blank=True, null=True)
    char_pub_field = fields.CharPGPPublicKeyField(blank=True,
                                                  null=True,
                                                  max_length=15)
    date_pgp_pub_field = fields.DatePGPPublicKeyField(blank=True, null=True)
    datetime_pgp_pub_field = fields.DateTimePGPPublicKeyField(blank=True,
                                                              null=True)
    time_pgp_pub_field = fields.TimePGPPublicKeyField(blank=True, null=True)
    decimal_pgp_pub_field = fields.DecimalPGPPublicKeyField(max_digits=8,
                                                            decimal_places=2,
                                                            null=True,
                                                            blank=True)
    float_pgp_pub_field = fields.FloatPGPPublicKeyField(blank=True, null=True)

    email_pgp_sym_field = fields.EmailPGPSymmetricKeyField(blank=True,
                                                           null=True)
    integer_pgp_sym_field = fields.IntegerPGPSymmetricKeyField(blank=True,
                                                               null=True)
    biginteger_pgp_sym_field = fields.BigIntegerPGPSymmetricKeyField(
        blank=True, null=True)
    pgp_sym_field = fields.TextPGPSymmetricKeyField(blank=True, null=True)
    char_sym_field = fields.CharPGPPublicKeyField(blank=True,
                                                  null=True,
                                                  max_length=15)
    date_pgp_sym_field = fields.DatePGPSymmetricKeyField(blank=True, null=True)
    datetime_pgp_sym_field = fields.DateTimePGPSymmetricKeyField(blank=True,
                                                                 null=True)
    time_pgp_sym_field = fields.TimePGPSymmetricKeyField(blank=True, null=True)
    decimal_pgp_sym_field = fields.DecimalPGPSymmetricKeyField(
        max_digits=8, decimal_places=2, null=True, blank=True)
    float_pgp_sym_field = fields.FloatPGPSymmetricKeyField(blank=True,
                                                           null=True)

    fk_model = models.ForeignKey(EncryptedFKModel,
                                 blank=True,
                                 null=True,
                                 on_delete=models.CASCADE)

    objects = EncryptedModelManager()

    class Meta:
        """Sets up the meta for the test model."""
        app_label = 'tests'
Beispiel #2
0
class EncryptedModel(models.Model):
    """Dummy model used for tests to check the fields."""
    digest_field = fields.TextDigestField(blank=True, null=True)
    digest_with_original_field = fields.TextDigestField(
        blank=True, null=True, original='pgp_sym_field')
    hmac_field = fields.TextHMACField(blank=True, null=True)
    hmac_with_original_field = fields.TextHMACField(blank=True,
                                                    null=True,
                                                    original='pgp_sym_field')

    email_pgp_pub_field = fields.EmailPGPPublicKeyField(blank=True, null=True)
    integer_pgp_pub_field = fields.IntegerPGPPublicKeyField(blank=True,
                                                            null=True)
    pgp_pub_field = fields.TextPGPPublicKeyField(blank=True, null=True)

    email_pgp_sym_field = fields.EmailPGPSymmetricKeyField(blank=True,
                                                           null=True)
    integer_pgp_sym_field = fields.IntegerPGPSymmetricKeyField(blank=True,
                                                               null=True)
    pgp_sym_field = fields.TextPGPSymmetricKeyField(blank=True, null=True)
    date_pgp_sym_field = fields.DatePGPSymmetricKeyField(blank=True, null=True)
    datetime_pgp_sym_field = fields.DateTimePGPSymmetricKeyField(blank=True,
                                                                 null=True)

    class Meta:
        app_label = 'tests'
class EncryptedModel(models.Model):
    """Dummy model used for tests to check the fields."""
    digest_field = fields.TextDigestField(blank=True, null=True)
    hmac_field = fields.TextHMACField(blank=True, null=True)

    email_pgp_pub_field = fields.EmailPGPPublicKeyField(blank=True, null=True)
    integer_pgp_pub_field = fields.IntegerPGPPublicKeyField(blank=True, null=True)
    pgp_pub_field = fields.TextPGPPublicKeyField(blank=True, null=True)

    email_pgp_sym_field = fields.EmailPGPSymmetricKeyField(blank=True, null=True)
    integer_pgp_sym_field = fields.IntegerPGPSymmetricKeyField(blank=True, null=True)
    pgp_sym_field = fields.TextPGPSymmetricKeyField(blank=True, null=True)