Add documentation for toSecretKey method

This commit is contained in:
Paul Schaub 2024-02-02 18:49:56 +01:00
parent 8e1e90c89a
commit fa9b07d2ce
Signed by: vanitasvitae
GPG Key ID: 62BEE9264BF17311
4 changed files with 12 additions and 16 deletions

View File

@ -270,6 +270,14 @@ open class GenerateOpenPgpKey(
}))
}
/**
* Convert a [OpenPgpComponentKeyBuilder.V4ComponentKeyBuilder] to a version 4
* [PGPSecretKey].
*
* @param key builder
* @param isPrimaryKey if true, the result will be a primary key, a subkey otherwise.
* @param encryptor encryptor to protect the secret key. Can be null for unencrypted keys.
*/
private fun toSecretKey(
key: OpenPgpComponentKeyBuilder.V4ComponentKeyBuilder<*>,
isPrimaryKey: Boolean,

View File

@ -100,16 +100,10 @@ interface KeyType {
@JvmStatic fun ECDSA(curve: EllipticCurve): ECDSA = ECDSA.fromCurve(curve)
/**
* Legacy EdDSA using Ed25519.
* For OpenPGP v4 only.
*/
/** Legacy EdDSA using Ed25519. For OpenPGP v4 only. */
@JvmStatic fun EDDSA(curve: EdDSACurve): EdDSA = EdDSA.fromCurve(curve)
/**
* Legacy ECDH using Curve25519.
* For OpenPGP v4 only.
*/
/** Legacy ECDH using Curve25519. For OpenPGP v4 only. */
@JvmStatic fun XDH(curve: XDHSpec): XDH = XDH.fromSpec(curve)
// TODO: Add crypto-refresh X25519, X448, Ed25519, Ed448

View File

@ -8,10 +8,7 @@ import org.bouncycastle.jce.spec.ECNamedCurveGenParameterSpec
import org.pgpainless.algorithm.PublicKeyAlgorithm
import org.pgpainless.key.generation.type.KeyType
/**
* Legacy EdDSA using Ed25519.
* For use with OpenPGP v4 only.
*/
/** Legacy EdDSA using Ed25519. For use with OpenPGP v4 only. */
class EdDSA private constructor(val curve: EdDSACurve) : KeyType {
override val name = "EdDSA"
override val algorithm = PublicKeyAlgorithm.EDDSA

View File

@ -8,10 +8,7 @@ import org.bouncycastle.jce.spec.ECNamedCurveGenParameterSpec
import org.pgpainless.algorithm.PublicKeyAlgorithm
import org.pgpainless.key.generation.type.KeyType
/**
* Legacy ECDH with Curve25519.
* For use with OpenPGP v4 only.
*/
/** Legacy ECDH with Curve25519. For use with OpenPGP v4 only. */
class XDH private constructor(spec: XDHSpec) : KeyType {
override val name = "XDH"
override val algorithm = PublicKeyAlgorithm.ECDH