diff options
Diffstat (limited to 'crypto/src/bcpg/PublicKeyPacket.cs')
-rw-r--r-- | crypto/src/bcpg/PublicKeyPacket.cs | 47 |
1 files changed, 25 insertions, 22 deletions
diff --git a/crypto/src/bcpg/PublicKeyPacket.cs b/crypto/src/bcpg/PublicKeyPacket.cs index bbed941dc..40c696a37 100644 --- a/crypto/src/bcpg/PublicKeyPacket.cs +++ b/crypto/src/bcpg/PublicKeyPacket.cs @@ -28,30 +28,33 @@ namespace Org.BouncyCastle.Bcpg validDays = (bcpgIn.ReadByte() << 8) | bcpgIn.ReadByte(); } - algorithm = (PublicKeyAlgorithmTag) bcpgIn.ReadByte(); + algorithm = (PublicKeyAlgorithmTag)bcpgIn.ReadByte(); - switch ((PublicKeyAlgorithmTag) algorithm) + switch (algorithm) { - case PublicKeyAlgorithmTag.RsaEncrypt: - case PublicKeyAlgorithmTag.RsaGeneral: - case PublicKeyAlgorithmTag.RsaSign: - key = new RsaPublicBcpgKey(bcpgIn); - break; - case PublicKeyAlgorithmTag.Dsa: - key = new DsaPublicBcpgKey(bcpgIn); - break; - case PublicKeyAlgorithmTag.ElGamalEncrypt: - case PublicKeyAlgorithmTag.ElGamalGeneral: - key = new ElGamalPublicBcpgKey(bcpgIn); - break; - case PublicKeyAlgorithmTag.ECDH: - key = new ECDHPublicBcpgKey(bcpgIn); - break; - case PublicKeyAlgorithmTag.ECDsa: - key = new ECDsaPublicBcpgKey(bcpgIn); - break; - default: - throw new IOException("unknown PGP public key algorithm encountered"); + case PublicKeyAlgorithmTag.RsaEncrypt: + case PublicKeyAlgorithmTag.RsaGeneral: + case PublicKeyAlgorithmTag.RsaSign: + key = new RsaPublicBcpgKey(bcpgIn); + break; + case PublicKeyAlgorithmTag.Dsa: + key = new DsaPublicBcpgKey(bcpgIn); + break; + case PublicKeyAlgorithmTag.ElGamalEncrypt: + case PublicKeyAlgorithmTag.ElGamalGeneral: + key = new ElGamalPublicBcpgKey(bcpgIn); + break; + case PublicKeyAlgorithmTag.ECDH: + key = new ECDHPublicBcpgKey(bcpgIn); + break; + case PublicKeyAlgorithmTag.ECDsa: + key = new ECDsaPublicBcpgKey(bcpgIn); + break; + case PublicKeyAlgorithmTag.EdDsa: + key = new EdDsaPublicBcpgKey(bcpgIn); + break; + default: + throw new IOException("unknown PGP public key algorithm encountered"); } } |