Packages

class InternalApi[FpType <: BigInt] extends AnyRef

Create a an instance which expects that hashFunc is a cryptographically secure hash function (such as sha256). Note that hash functions which produce more than 256 bits worth will be reduced to values less than Curve.Order because they're multiplied by the hash points, which are cyclic in Curve.Order.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. InternalApi
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new InternalApi(hashFunc: Sha256Hash, ed25519Signing: Ed25519Signing, curvePoints: CurvePoints[FpType])(implicit arg0: Hashable[FpType], arg1: Field[FpType], arg2: ExtensionField[FpType], arg3: Eq[FpType], arg4: PairingConfig[FpType], mods: ModsByPrime[FpType])

Type Members

  1. type ErrorOr[A] = Either[EncryptError, A]

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
  6. final def decrypt(privateKey: PrivateKey[FpType], signedEncryptedValue: SignedValue[EncryptedValue[FpType]]): ErrorOr[FP12Elem[FpType]]

    Decrypt the signedEncryptedValue, verifying that the embedded public signing key matches the signing private key and that the plaintext hash matches the included authHash.

    Decrypt the signedEncryptedValue, verifying that the embedded public signing key matches the signing private key and that the plaintext hash matches the included authHash. This method handles both "encrypted once" and "reencrypted" messages.

    privateKey

    the private key of the recipient of the message

    signedEncryptedValue

    the output of encrypt() or reencrypt()

    returns

    ErrorOr[FP12Elem] the decrypted value, which is an element of G_T, or an error (which might be caused by an authHash comparision failure or a signature validation failure)

  7. final def encrypt(publicKey: PublicKey[FpType], plaintext: FP12Elem[FpType], ephemPrivateKey: PrivateKey[FpType], publicSigningKey: PublicSigningKey, privateSigningKey: PrivateSigningKey): SignedValue[EncryptedValue[FpType]]

    Encrypt plaintext to publicKey.

    Encrypt plaintext to publicKey. This public key encryption is not meant to encrypt arbitrary data; instead, you should generate a random plaintext value (an element of G_T), apply a SHA256 hash to it to generate a 32-bit number, and use that as a key for a symmetric algorithm like AES256-GCM to encrypt the data. Then use this method to encrypt the plaintext.

    Note that the encrypting privateKey is ephemeral.

    The result will have the publicSigningKey embedded and be signed by the privateSigningKey. It also includes a authentication hash that the decrypter can use to confirm that the final result after decryption matches the value that was encrypted.

    publicKey

    the public key to encrypt to

    plaintext

    the value to encrypt - must be an element of G_T

    ephemPrivateKey

    a random private key value chosen just for this plaintext

    publicSigningKey

    the public portion of the encrypter's signing key pair

    privateSigningKey

    the private portion of the encrypter's signing key pair

    returns

    SignedValue[EncryptedValue] - the plaintext encrypted to the specified public key, along with the authHash, public signing key, and signature

  8. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  9. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  10. final def generateReencryptionKey(fromPrivateKey: PrivateKey[FpType], toPublicKey: PublicKey[FpType], reencryptionPrivateKey: PrivateKey[FpType], newK: FP12Elem[FpType], publicSigningKey: PublicSigningKey, privateSigningKey: PrivateSigningKey): SignedValue[ReencryptionKey[FpType]]

    Generate a reencryption key which allows the private key of toPublicKey to decrypt a message from fromPublicKey.

    Generate a reencryption key which allows the private key of toPublicKey to decrypt a message from fromPublicKey. The result will be signed using the signingKey.

    fromPrivateKey

    - The privateKey matching the fromPublicKey

    toPublicKey

    - the public key to transform to

    reencryptionPrivateKey

    - a random private key

    newK

    - a random FP12 element

    publicSigningKey

    - Ed25519 public key to include to validate signature

    privateSigningKey

    - Ed25519 private key to use to sign reencryption key

    returns

    reencryption key, along with an Ed25519 public signing key and Ed25519 signature

  11. def generateRthRoot(fp12Elem: FP12Elem[FpType]): FP12Elem[FpType]
  12. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  13. final def hash2(fp12: FP12Elem[FpType]): HomogeneousPoint[FP2Elem[FpType]]

    Arbitrary hash function to hash an integer into points base field subgroup of the elliptic curve.

    Arbitrary hash function to hash an integer into points base field subgroup of the elliptic curve.

    fp12

    - An Fp12 element.

    returns

    a point in G1, in homogeneous coordinates.

  14. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  15. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  16. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  17. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  18. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  19. val pair: (HomogeneousPoint[FpType], HomogeneousPoint[FP2Elem[FpType]]) => FP12Elem[FpType]
  20. final def reencrypt(signedReencryptionKey: SignedValue[ReencryptionKey[FpType]], signedEncryptedValue: SignedValue[EncryptedValue[FpType]], raRePriKey: PrivateKey[FpType], raReK: FP12Elem[FpType], publicSigningKey: PublicSigningKey, privateSigningKey: PrivateSigningKey): ErrorOr[SignedValue[EncryptedValue[FpType]]]

    Reencrypt an EncryptedValue to a new user.

    Reencrypt an EncryptedValue to a new user. This can be the output of either encrypt() or reencrypt(). Will fail if the transformKey signature fails to verify.

    signedReencryptionKey

    - A signed version of the reencryption key, which allows a transform from a delegater to a delegatee

    signedEncryptedValue

    - A signed version of the encrypted value, which is encrypted to the delegating user.

    raRePriKey

    - A new random private key, which will be used to encrypt the raReK.

    raReK

    - A new random integer which is used to ensure that the reencryption block cannot be reused.

    publicSigningKey

    - The ED25519 public key matching the privateSigningKey.

    privateSigningKey

    - The ED25519 private key to sign the reencryption block.

    returns

    - Right(ReencryptedValue) if the value could be successfully reencrypted

    • Left(SignatureFailed|ReencryptionKeyIsCorrupt) - if the signatures weren't valid.
  21. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  22. def toString(): String
    Definition Classes
    AnyRef → Any
  23. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  24. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  25. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

Inherited from AnyRef

Inherited from Any

Ungrouped