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
.
- Alphabetic
- By Inheritance
- InternalApi
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- 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
- type ErrorOr[A] = Either[EncryptError, A]
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- 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)
- 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 theprivateSigningKey
. 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
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- 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 fromfromPublicKey
.Generate a reencryption key which allows the private key of
toPublicKey
to decrypt a message fromfromPublicKey
. 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
- def generateRthRoot(fp12Elem: FP12Elem[FpType]): FP12Elem[FpType]
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- 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.
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- val pair: (HomogeneousPoint[FpType], HomogeneousPoint[FP2Elem[FpType]]) => FP12Elem[FpType]
- 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.
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated