@@ -11,24 +11,7 @@ import (
1111// Default returns a custom profile that support features
1212// that are widely implemented.
1313func Default () * Custom {
14- setKeyAlgorithm := func (cfg * packet.Config , securityLevel int8 ) {
15- cfg .Algorithm = packet .PubKeyAlgoEdDSA
16- switch securityLevel {
17- case constants .HighSecurity :
18- cfg .Curve = packet .Curve25519
19- default :
20- cfg .Curve = packet .Curve25519
21- }
22- }
23- return & Custom {
24- SetKeyAlgorithm : setKeyAlgorithm ,
25- Hash : crypto .SHA256 ,
26- CipherEncryption : packet .CipherAES256 ,
27- CompressionAlgorithm : packet .CompressionZLIB ,
28- CompressionConfiguration : & packet.CompressionConfig {
29- Level : 6 ,
30- },
31- }
14+ return ProtonV1 ()
3215}
3316
3417// RFC4880 returns a custom profile for this library
@@ -142,3 +125,37 @@ func Symmetric() *Custom {
142125 V6 : true ,
143126 }
144127}
128+
129+ // ProtonV1 is the version 1 profile used in proton clients.
130+ func ProtonV1 () * Custom {
131+ setKeyAlgorithm := func (cfg * packet.Config , securityLevel int8 ) {
132+ cfg .Algorithm = packet .PubKeyAlgoEdDSA
133+ switch securityLevel {
134+ case constants .HighSecurity :
135+ cfg .Curve = packet .Curve25519
136+ default :
137+ cfg .Curve = packet .Curve25519
138+ }
139+ }
140+ s2kConfig := s2k.Config {
141+ S2KMode : s2k .IteratedSaltedS2K ,
142+ Hash : crypto .SHA256 ,
143+ S2KCount : 65536 ,
144+ }
145+ return & Custom {
146+ SetKeyAlgorithm : setKeyAlgorithm ,
147+ Hash : crypto .SHA512 ,
148+ CipherEncryption : packet .CipherAES256 ,
149+ CipherKeyEncryption : packet .CipherAES256 ,
150+ CompressionAlgorithm : packet .CompressionZLIB ,
151+ CompressionConfiguration : & packet.CompressionConfig {
152+ Level : 6 ,
153+ },
154+ S2kKeyEncryption : & s2kConfig ,
155+ S2kEncryption : & s2kConfig ,
156+ DisableIntendedRecipients : true ,
157+ AllowAllPublicKeyAlgorithms : true ,
158+ InsecureAllowWeakRSA : true ,
159+ InsecureAllowDecryptionWithSigningKeys : true ,
160+ }
161+ }
0 commit comments