@@ -107,41 +107,5 @@ public static void KeyPairFromSeed(ArraySegment<byte> publicKey, ArraySegment<by
107
107
expandedPrivateKey . Array , expandedPrivateKey . Offset ,
108
108
privateKeySeed . Array , privateKeySeed . Offset ) ;
109
109
}
110
-
111
- [ Obsolete ( "Needs more testing" ) ]
112
- public static byte [ ] KeyExchange ( byte [ ] publicKey , byte [ ] privateKey )
113
- {
114
- var sharedKey = new byte [ SharedKeySizeInBytes ] ;
115
- KeyExchange ( new ArraySegment < byte > ( sharedKey ) , new ArraySegment < byte > ( publicKey ) , new ArraySegment < byte > ( privateKey ) ) ;
116
- return sharedKey ;
117
- }
118
-
119
- [ Obsolete ( "Needs more testing" ) ]
120
- public static void KeyExchange ( ArraySegment < byte > sharedKey , ArraySegment < byte > publicKey , ArraySegment < byte > privateKey )
121
- {
122
- if ( sharedKey . Array == null )
123
- throw new ArgumentNullException ( "sharedKey.Array" ) ;
124
- if ( publicKey . Array == null )
125
- throw new ArgumentNullException ( "publicKey.Array" ) ;
126
- if ( privateKey . Array == null )
127
- throw new ArgumentNullException ( "privateKey" ) ;
128
- if ( sharedKey . Count != 32 )
129
- throw new ArgumentException ( "sharedKey.Count != 32" ) ;
130
- if ( publicKey . Count != 32 )
131
- throw new ArgumentException ( "publicKey.Count != 32" ) ;
132
- if ( privateKey . Count != 64 )
133
- throw new ArgumentException ( "privateKey.Count != 64" ) ;
134
-
135
- FieldElement montgomeryX , edwardsY , edwardsZ , sharedMontgomeryX ;
136
- FieldOperations . fe_frombytes ( out edwardsY , publicKey . Array , publicKey . Offset ) ;
137
- FieldOperations . fe_1 ( out edwardsZ ) ;
138
- MontgomeryCurve25519 . EdwardsToMontgomeryX ( out montgomeryX , ref edwardsY , ref edwardsZ ) ;
139
- byte [ ] h = Sha512 . Hash ( privateKey . Array , privateKey . Offset , 32 ) ; //ToDo: Remove alloc
140
- ScalarOperations . sc_clamp ( h , 0 ) ;
141
- MontgomeryOperations . scalarmult ( out sharedMontgomeryX , h , 0 , ref montgomeryX ) ;
142
- CryptoBytes . Wipe ( h ) ;
143
- FieldOperations . fe_tobytes ( sharedKey . Array , sharedKey . Offset , ref sharedMontgomeryX ) ;
144
- MontgomeryCurve25519 . KeyExchangeOutputHashNaCl ( sharedKey . Array , sharedKey . Offset ) ;
145
- }
146
110
}
147
111
}
0 commit comments